You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.
Template caching isn't working in production because of a naming conflict with the admin and theme layout file (resolve in Postleaf/empower-theme@04ed6bd).
Turns out, there are more issues related to this:
A race condition exists when using useThemeViews() and useSystemViews(). A proper renderer needs to be used for admin and theme views to avoid this.
Adaro doesn't support multiple view folders (patch submitted).
Even with multiple view folders, Dust caching is based on the template's name instead of its location, meaning you can't switch themes without restarting the app. (Dust cache can't be cleared because dust is internal to Adaro.)
Using chunk.partial() to render the theme toolbar in theme_helpers.js is causing theme views to hang.
Need to ensure custom error pages still work once a solution is in place.
The text was updated successfully, but these errors were encountered:
Due to the way Dust.js caches templates using the template's name instead of its full path, switching themes wasn't possible in production without restarting the app.
One solution I tried was patching Adaro to support multiple view folders, but again, due to the way Dust.js uses the template name instead of its full path, the problem persisted.
To solve this, I created a custom rendering engine for Postleaf that disables both Express caching and Dust.js caching in lieu of its own:
I also removed the useThemeViews() and useSystemViews() methods that caused the race condition. Now, the engine will try to load templates first from the theme directory, then from the system directory. As a side effect, fallback templates (such as not_found.dust and application_error.dust) work without extra code now. As another side effect, it's now possible for a theme to use its own Zen Mode template simply by providing zen_mode.dust.
To prevent template naming conflicts and accidental overloading, admin views have been moved from source/views to source/views/admin. (It's also technically possible, although not advisable and not supported, to overload admin templates by including them in an admin folder in your theme.)
The new engine could probably be split into its own project at some point. As far as I can tell, it's the only Dust.js engine for Express that supports dynamic views and multiple view folders.
Rolling my own solution wasn't my preferred approach, but after three days of working with Adaro and other existing engines to resolve this, it became necessary. I'm happy to say that template caching now works properly in production. 😎
Template caching isn't working in production because of a naming conflict with the admin and theme layout file (resolve in Postleaf/empower-theme@04ed6bd).
Turns out, there are more issues related to this:
useThemeViews()
anduseSystemViews()
. A proper renderer needs to be used for admin and theme views to avoid this.dust
is internal to Adaro.)chunk.partial()
to render the theme toolbar intheme_helpers.js
is causing theme views to hang.The text was updated successfully, but these errors were encountered: