New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SLING-11087: Fix for multiple components being fetched via JSI #23
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contributions! I don't think we really have someone familiar with the module ready to review, so I'll give this a shot.
My only question is whether using let
instead of var
is safe from the point of view of browser support. If that is not the case, have you considered using an IIFE?
Seems Using Another solution could be to append the |
Personally, I would be slightly more comfortable with the IIFE approach. Not because it is better, but because it conveys the intent about encapsulation of the scope more clearly than. While I am sure you are correct and |
The primary issue is that it should stay within the <script>-scope. If multiple components are to be replaced you have multiple <script> sections with the same variables. Using I will update the PR however when I get time to test it properly as well. |
Upon testing I agree your proposal is much cleaner. As I fall into the previously mentioned Java group of Sling developers I am not too sure about browser support for the anonymous function used in the IIFE pattern. Reverted previous commit and introduced an IIFE-based solution. |
Kudos, SonarCloud Quality Gate passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, thanks! @jsedding - any comments?
LFTM as well. Thank you! |
Bugfix: https://issues.apache.org/jira/browse/SLING-11087
Fixes scope related issues in JSI causing only one component to be shown in cases where multiple components should be fetched asynchronously.