Fix the analysis re-run button silently doing nothing - #1063
Closed
skerbis wants to merge 1 commit into
Closed
Conversation
The button's click handler was only ever bound from a DOMContentLoaded listener. A script added via rex_view::addJsFile() can finish loading/executing after that event already fired (common on a backend page with many other scripts), in which case the listener never runs at all - no handler ever gets bound, and the link's href="#" just does nothing on click, which is exactly what was being seen. Fixed the same way this project's own ai-chat-warm-cache.js already does it: try a jQuery "rex:ready" listener (also covers REDAXO's own AJAX-driven content swaps), fall back to DOMContentLoaded, and call init() unconditionally as well to cover the case where the DOM is already ready by the time this script runs. init() now guards against running its setup more than once per page load (a dataset flag on the app root), since it can legitimately fire from multiple triggers now. Also moved the script registration from pages/analysis.php into boot.php, gated to this subpage specifically - matches this addon's own existing confetti.min.js pattern instead of introducing a second, different way of loading a JS file for the same page. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 4, 2026
Member
Author
4 tasks
Member
Author
|
Combined into #1068. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #1062 (toolbar hardening) — please review/merge that one first.
The button's click handler was only ever bound from a
DOMContentLoadedlistener. A script added viarex_view::addJsFile()can finish loading/executing after that event already fired (common on a backend page with many other scripts), in which case the listener never runs at all - no handler ever gets bound, and the link'shref="#"just does nothing on click, which is exactly what was being observed.Fixed the same way this project's own
ai-chat-warm-cache.jsalready does it: try a jQueryrex:readylistener (also covers REDAXO's own AJAX-driven content swaps), fall back toDOMContentLoaded, and callinit()unconditionally as well to cover the case where the DOM is already ready by the time this script runs.init()now guards against running its setup more than once per page load (a dataset flag on the app root), since it can legitimately fire from multiple triggers now.Also moved the script registration from
pages/analysis.phpintoboot.php, gated to this subpage specifically - matches this addon's own existingconfetti.min.jspattern instead of introducing a second, different way of loading a JS file for the same page.Test plan
php -l+ PHPStan on the changed files: 0 findings.🤖 Generated with Claude Code