Fix JavaScript pack output for SAML post-binding template#4592
Merged
Conversation
**Why:** So that users are redirected automatically when completing SAML authentication. In #4553, all JavaScript packs were changed to use the `javascript_packs_tag_once` helper, which is intended to be used in rendering all JavaScript chunks once at the bottom of the page. However, this must be complemented by a call to the `render_javascript_pack_once_tags` helper. This exists in the base template, but since the `saml_post_binding` view doesn't inherit from this template, the helper is never called, and therefore the script is never added to the page. Since we don't need to worry as much about deduplicating script chunks on this page, we can simply call directly to Webpacker's `javascript_packs_with_chunks_tag` helper.
jmhooper
approved these changes
Jan 15, 2021
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.
Why: So that users are redirected automatically when completing SAML authentication.
In #4553, all JavaScript packs were changed to use the
javascript_packs_tag_oncehelper, which is intended to be used in rendering all JavaScript chunks once at the bottom of the page. However, this must be complemented by a call to therender_javascript_pack_once_tagshelper. This exists in the base template, but since thesaml_post_bindingview doesn't inherit from this template, the helper is never called, and therefore the script is never added to the page.Since we don't need to worry as much about deduplicating script chunks on this page, we can simply call directly to Webpacker's
javascript_packs_with_chunks_taghelper. Alternatively, we could add the call torender_javascript_pack_once_tagssomewhere within the page template (ideally toward the bottom of markup).In making these changes, I checked to confirm there are no other instances of views not inheriting from the base template where script enqueuing via
javascript_packs_tag_onceis occurring.