-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Updating Page#url_name should touch related Nodes for cache invalidation #2080
Comments
Every time a page gets updated all related nodes get updated as well. alchemy_cms/app/models/alchemy/page.rb Line 147 in c998f08
Do you have an example where this does not work for you? |
Wow, I completely missed that piece of code! I've seen my menu not picking up url changes, but I'll check again later tonight when I am back at the computer. |
@tvdeyen I just ran some tests in a more debuggable environment (local dev) with caching activated. tl;dr – I found the same behaviour as initially explained. For my tests I am using the auto generated menu partials (
|
The main problem with the menu cache is that the root node is not updated / touched.
If we open the log and look for the lines starting with "Write fragment views/alchemy/menus/", we find them only on the first load, not in the second. We have only "Read fragment views/alchemy/menus/" on the second. |
Ha, TIL |
Menu partials might be cached. So we need to make sure the menu node a page might be attached to and all their ancestors get touched as well. Closes AlchemyCMS#2080
Menu partials might be cached. So we need to make sure the menu node a page might be attached to and all their ancestors get touched as well. Closes AlchemyCMS#2080
@robinboening could you please test #2226 ? I tested and it worked for me. Would appreciate if you could make some testing as well @afdev82 |
I tested the branch and it works. |
@afdev82 thanks. @robinboening what do you think? |
Menu partials might be cached. So we need to make sure the menu node a page might be attached to and all their ancestors get touched as well. Closes AlchemyCMS#2080
Menu partials might be cached. So we need to make sure the menu node a page might be attached to and all their ancestors get touched as well. Closes AlchemyCMS#2080
Menu partials might be cached. So we need to make sure the menu node a page might be attached to and all their ancestors get touched as well. Closes #2080
Is your feature request related to a problem? Please describe.
A menu cache is swept only when applying a direct change to the menu. In the case where a menu node is coupled with a Page, the node doesn't store the url but delegates to the Page, hence the node itself receives no update when the URL updates.
The reason why it currently doesn't lead to 404s is because the legacy page feature kicks in and redirects to the latest url. Anyhow, I believe the nodes should keep up to date with the page information.
Describe the solution you'd like
I think whenever a Page#url_name gets updated the corresponding menu nodes should be touched in order to invalidate the menu cache.
The text was updated successfully, but these errors were encountered: