-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
Possibly problematic defaults in menu templates #2138
Labels
Comments
Yes, this is an issue. You are able to build your own cache key like you already described, but we should update the default templates. Would you mind to open a PR? Thanks for bringing this into attention! |
oneiros
added a commit
to oneiros/alchemy_cms
that referenced
this issue
Jul 6, 2021
With the currently generated pages how menus are being displayed depends on the (current) page and whether one is in preview mode or not. Thus both facts should probably go in the cache key as well.
oneiros
added a commit
to oneiros/alchemy_cms
that referenced
this issue
Jul 6, 2021
With the currently generated templates the way menus are being displayed depends on the (current) page and whether one is in preview mode or not. Thus both facts should probably go in the cache key as well.
oneiros
added a commit
to oneiros/alchemy_cms
that referenced
this issue
Jul 9, 2021
With the currently generated templates the way menus are being displayed depends on the (current) page and whether one is in preview mode or not. Thus both facts should probably go in the cache key as well.
robinboening
pushed a commit
to robinboening/alchemy_cms
that referenced
this issue
Aug 13, 2021
With the currently generated templates the way menus are being displayed depends on the (current) page and whether one is in preview mode or not. Thus both facts should probably go in the cache key as well.
tvdeyen
added a commit
that referenced
this issue
Sep 15, 2021
- Return only pages from current site in api [#2169](#2169) ([afdev82](https://github.com/afdev82)) - Improve cache key defaults for menus #2138 [#2160](#2160) ([oneiros](https://github.com/oneiros)) - generate picture thumbnails only for pictures with convertible format [#2130](#2130) ([afdev82](https://github.com/afdev82)) - Backport #2114 to v5.2 [#2116](#2116) ([afdev82](https://github.com/afdev82)) - Add webpacker tasks to Alchemy upgrader [#2115](#2115) ([dbwinger](https://github.com/dbwinger))
gr8bit
added a commit
to bichinger/alchemy_cms
that referenced
this issue
Apr 12, 2022
….2-stable___with-active-storage * '5.2-stable' of github.com:AlchemyCMS/alchemy_cms: (36 commits) Revert "Pin Ransack to below 2.4.2" Bump version to v5.2.7 Autoformat page_spec.rb Fix copying page with descendants to a different language Handle copying/pasting global pages Bump version to v5.2.6 Add crop_resize Dragonfly processor make the admin error tracker customizable Bump version to v5.2.5 Adjust tinymce skin assets urls again Bump version to v5.2.4 Set stampable user_class_name without root identifier Use relative path for tinymce font-face Bump version to v5.2.3 Make sure to install correct npm package Bump version to v5.2.2 Do not leak all pages for guest users in API controller Only return pages for current site in API Improve cache key defaults for menus AlchemyCMS#2138 Bump NPM package version to 5.2.1 ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for not using the template. I found the following hard to get into that format.
The default templates for menu views include caching. This is the current (slim) version for a single node:
alchemy_cms/lib/generators/alchemy/menus/templates/node.html.slim
Lines 1 to 13 in 137701d
It uses the node itself as cache key, which seems fine at first, but upon closer inspection, there are two more things affecting the actual display of the node: An
active
class is added if the node is the current page and thehref
is replaced withjavascript: void(0)
in preview mode.We stumbled upon this when in production the navigation would sometimes stop working. It was always the case when an editor opened a page in preview mode before any normal users accessed a page with the same menu. In that case the☹️
javascript: void(0)
landed in the cached versionWe solved this by composing a more complex cache key from
[node, @page, @preview_mode]
. I am not sure this is the most elegant solution, especially as this needs to be repeated in the wrapper template.All in all this is no big deal as most sites will probably make heavy modifications to these templates anyway. Just wanted to let you know that these defaults might not be ideal.
The text was updated successfully, but these errors were encountered: