forked from BroadleafCommerce/BroadleafCommerce
-
Notifications
You must be signed in to change notification settings - Fork 0
TL3: expose self-closing model-variable processors' values to sibling markup #13
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
Open
devin-ai-integration
wants to merge
2
commits into
migration/java-21-migration
Choose a base branch
from
devin/p2-core-tl3-localvar-fix
base: migration/java-21-migration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
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.
🚩 Other self-closing processors may also need the addToRequest pattern
Several other subclasses of
AbstractModelVariableModifierProcessorstill useaddToModel(local variable scoping) and may also be used as self-closing elements whose values are consumed by sibling markup. For example:ConfigVariableProcessor.java:60setsresultVarviaaddToModelBreadcrumbProcessor.java:66setsresultVarviaaddToModelDataDrivenEnumerationProcessor.java:91setsenumValuesviaaddToModelRatingsProcessor.java:66,75sets rating data viaaddToModelRelatedProductProcessor.java:85-88sets product data viaaddToModelIf any of these are used as self-closing elements (e.g.,
<blc:config ... />), the local variable will have no body to scope into and the value will be invisible to siblings. This is the same problem this PR aims to fix forNamedOrderProcessorandGoogleAnalyticsProcessor. Each processor's usage pattern in templates would need to be audited.(Refers to lines 74-77)
Was this helpful? React with 👍 or 👎 to provide feedback.
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.
Valid follow-up. This PR is deliberately scoped to the two processors whose javadoc explicitly documents self-closing + sibling usage:
NamedOrderProcessor:<blc:named_order orderVar="wishlist" .../>then<span th:text="${wishlist...}"/>GoogleAnalyticsProcessor:<blc:googleanalytics/>then<script th:utext="${analytics}"/>The base-class
addToRequest()helper is now available for any others confirmed to need it. The remaining candidates split two ways:ConfigVariableProcessor,BreadcrumbProcessor,DataDrivenEnumerationProcessorlive in thecommonmodule, outside this task'sbroadleaf-framework-webscope.RatingsProcessor,RelatedProductProcessorare inbroadleaf-framework-web, but their javadocs don't document a self-closing+sibling pattern, and the prior merged fix intentionally kept them on the body-scopedremoveTags()approach.Confirming which are actually used as self-closing elements requires the demo-site templates, which aren't in this repo, so I'd recommend a dedicated template-usage audit as the follow-up rather than blindly switching them. Note
addToRequestis strictly broader than a body-local (a request attribute is visible both inside the body and to siblings), but it persists for the whole request, so local-variable scoping remains preferable wherever a body actually consumes the value.