Skip to content
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

variable defined inside cache tags are not available outside #1561

Open
dadaxr opened this issue Nov 27, 2024 · 0 comments
Open

variable defined inside cache tags are not available outside #1561

dadaxr opened this issue Nov 27, 2024 · 0 comments

Comments

@dadaxr
Copy link
Contributor

dadaxr commented Nov 27, 2024

Add a warning in doc to mention that any defined variable inside {{ cache }} tags wont be available outside of them when the content is fetched from the cache...

It could be confusing from a DX perspective, as the first time the tag is executed (ie no cache), variable will be available outside, but then, it wont...

as an example, dont do this :

{{ myEntries = [] }}
{{ cache for="24 hours" }}
 {{ myEntries = { collection:xxx } {{# whatever #}}
{{ /cache }}

{{# here my entries will only be set at the first rendering but then it will be an empty array #}}
{{ myEntries }}
 ...
{{ /myEntries }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant