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

default modifier ignores nocache on variables #1026

Open
MichaONO opened this issue May 31, 2024 · 0 comments
Open

default modifier ignores nocache on variables #1026

MichaONO opened this issue May 31, 2024 · 0 comments

Comments

@MichaONO
Copy link

Hi,

I stumbled upon the following: I have a variable that is assigned in php with nocache set to true. But sometimes the variable does not get assigned at all. So I use the default modifier in the template for cases where the variable is not assigned. Caching is enabled.

Now when the template gets compiled while the variable is not assigned the compiler does not know about the nocache and thus probably caches the default value. When the page gets rendered again with the variable set (and nocache set to true), it still gets ignored. I suspect the reason is that the default value got cached during the compile step.

So I'd be happy if you could change this in a way that default values never get cached. The downside would be that also variables where the default is really cacheable would not get cached as well so I can understand why you would not want this. In that case I'd be happy if you could consider the following ideas:

  • Warn in the documentation you should not use default for variables that have nocache set
  • Warn during the compile step if the default modifier is present (but not applied) for a variable which has nocache set
  • Implement a nocache modifier or a default_nocache modifier

Also I could just avoid using default for variables with nocache set or try using the nocache tag everywhere I use default. But that would not help anyone who stumples over the same thing and wonders what is going on.

Thanks
Michael

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