Page variable is overwritten when page.js.twig is included in a dynamically loaded component #1104
Labels
confirmed bug
Something isn't working
frontend
The frontend interface
needs discussion
A decision needs to be taken by the dev team
Milestone
page.js.twig
currently sets thepage
Javascript variable to import page-specific variables from the server into the client JS environment. However it looks like in some cases we load this partial both in the base page as well as dynamic components such as modal forms.This means that the original value set in the base page gets completely overwritten when the modal form is loaded.
The simplest solution seems to be merging, rather than setting, the page variable by changing
page.js.twig
:This doesn't completely guarantee that nested values in
page
won't be overwritten, of course. But it at least provides a mechanism for easily setting additional client-side variables while keeping them scoped under the top-levelpage
object.The text was updated successfully, but these errors were encountered: