[18.0][FIX] base_rest: do not crash the frontend boot outside the Swagger page#1
Open
eantones wants to merge 1 commit into
Open
[18.0][FIX] base_rest: do not crash the frontend boot outside the Swagger page#1eantones wants to merge 1 commit into
eantones wants to merge 1 commit into
Conversation
…gger page
swagger_ui.js rides web.assets_frontend_lazy, so its whenReady bootstrap
runs on every frontend page. Outside the Swagger UI page
document.getElementById("swagger-ui") is null and .getAttribute() throws
a TypeError in the console on every page load (login included). Guard the
bootstrap so it only mounts when the element exists.
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.
swagger_ui.jsis loaded inweb.assets_frontend_lazy, so itswhenReadybootstrap runs on every frontend page. Outside the Swagger UI page,document.getElementById("swagger-ui")returnsnulland the following.getAttribute()throws aTypeErrorin the browser console on every page load — the login page included.Guard the bootstrap so it only mounts the component when the element exists. Version bumped for the asset rebuild.
Found during a real 14.0 → 18.0 migration smoke pass (console error on
/web/loginreproduced with Playwright, gone after the guard).