Replies: 5 comments 15 replies
-
I like the current behavior. It seems that are a few use-cases where isolation may be useful compared to not isolated, so IMHO we're good :) |
Beta Was this translation helpful? Give feedback.
-
I strongly think we should model tags and scoping after what the Quarkus users are most used to, which is Java and lexical scoping. It's very confusing and error-prone to access data that doesn't come from the current scope, because copying one tag from one place to another might yield different results that are hard to understand. Also it's contradictory with the idea of passing parameters to it. And last, it pretty much breaks tag parameter declaration and type-safety. |
Beta Was this translation helpful? Give feedback.
-
Except in this case, it's an include, so it's as if that method was part of many classes, all of which have different internal state. Think macros more than methods. I prefer methods. Macros are often unhygienic: https://en.wikipedia.org/wiki/Hygienic_macro |
Beta Was this translation helpful? Give feedback.
-
Hey folks, Sorry to pop this subject up but: Yesterday I had an issue which took me a while to find and fix, a tag I was using which comes from the web-bundler use It feels like a tag shouldn't use the scope data but only what is sent through params unless explicitly configured too. The current behavior is hazardous, unnatural and very hard to spot or debug.
|
Beta Was this translation helpful? Give feedback.
-
Currently, a tag template can reference data from the parent context. However, it might make sense to disable this behavior and execute the tag as an isolated template, i.e. without access to the context of the template that calls the tag. There is a PR #22003 where the
_isolated
argument was added to control the behavior.However, we're not entirely sure whether the default behavior should be changed as well, i.e. execute the tag as an isolated template by default.
The main disadvantage of the current behavior is that if an argument is not overriden on the call site a value from the parent context may unexpectedly leak to the rendered tag:
and
AND AFTER THE CHANGE:
OTOH the current behavior may come in handy in some situations. Also it would be a breaking change - although it was not documented before and it would not be the first one and definitely not the last one ;-).
Beta Was this translation helpful? Give feedback.
All reactions