FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
189 stars 228 forks source link

Render uncache caches parameters #1705

Closed kledo-34 closed 3 years ago

kledo-34 commented 3 years ago

Hey there, I updated vhs with an update to Typo3 10.4 and a difference now is, that in an uncache partial there are not all variables accessible anymore, but only those that were sent as parameters, this was different before. My problem now is, that I was displaying personal information for front end users with "users." (e.g. users.email). This variable is now not accassible in the unached partial anymore so I need to send it as a parameter, but the parameters get cached, so all users will see the data of the user who first loads the page. I'm not sure if this is how everything should be, if it is, is there a solution to my problem? Thanks for any solutions

NamelessCoder commented 3 years ago

Since the arguments for v:render.uncache come from the cached template, they will be cached along with the "outer" template - and will be the same on all subsequent calls. As the ViewHelper doc comment states, Arguments must be serializable and will be cached. - so your arguments should only contain things that aren't login-specific or dynamically generated (e.g. things from {settings}).

If you need a dynamically loaded variable within the uncached template you will need to read this from inside the uncached part. In your case, if you need the user details you can write a ViewHelper that reads these from globals/aspects and assigns them as a template variable, and then use this ViewHelper within the uncached part.

kledo-34 commented 3 years ago

Alright, thanks a lot for your answer and suggestion, I will do it that way and thank you very much for your effort to maintain this extension ;)