Skip to content

Conversation

@mjauvin
Copy link
Member

@mjauvin mjauvin commented Jan 13, 2026

When returning a RedirectResponse that triggers a download in the browser, the loading indicator does not get hidden because the ajaxRedirected event is not triggered.

Using a button form field type with a request ajax handler that returns a RedirectResponse is broken without this PR as the load indicator keeps showing ever the response is received.

btn:
  type: button
  buttonLabel: My Button
  request: onGetRedirectResponse
  loading: waiting...

Summary by CodeRabbit

  • New Features
    • Added new render hook to attach handlers and respond to render events
    • Exposed global utilities for HTML sanitization and JSON parsing to external code
    • Enhanced redirect handling with improved navigation flow and reduced delays
    • Added support for new redirect flow type in AJAX update handling

✏️ Tip: You can customize this high-level summary in your review settings.

@mjauvin mjauvin added this to the 1.2.10 milestone Jan 13, 2026
@mjauvin mjauvin self-assigned this Jan 13, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

Walkthrough

The pull request introduces new public utilities to the framework (ocSanitize, ocJSON) and adds a jQuery render hook, while refactoring redirect handling to use direct window navigation instead of popstate events. Minor formatting adjustments are made to minified assets.

Changes

Cohort / File(s) Summary
Minified asset formatting
modules/backend/formwidgets/richeditor/assets/js/build-plugins-min.js, modules/backend/widgets/table/assets/js/build-min.js
Line breaks and array restructuring with no functional behavior changes.
Framework source redirect refactoring
modules/system/assets/js/framework.js
Removed popstate event dependency from redirect handling; now triggers ajaxRedirected immediately before calling window.location.assign(url).
Framework minified utilities and API expansion
modules/system/assets/js/framework-min.js, modules/system/assets/js/framework.combined-min.js
Added public methods: $.fn.render(callback), window.ocSanitize(html), window.ocJSON(json). Extended redirect handling with handleRedirectResponse(url) triggering full navigation. Added support for X\_WINTER\_REDIRECT flow in update handling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Trigger ajaxRedirected event always' accurately summarizes the main change: ensuring the ajaxRedirected event is consistently emitted for redirect responses, including download scenarios.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@LukeTowers LukeTowers merged commit 22df8f1 into develop Jan 13, 2026
14 checks passed
@LukeTowers LukeTowers deleted the fix-ajax-redirect branch January 13, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants