mkdocs-material: Projects plugin cache not being updated

Context

Using the projects plugin in Insiders, I am having the problem that it seems the cache is never updated.

Bug description

Changes to the mkdocs.yml files in project do not get picked up. I am changing the color scheme as an example, see below. It seems the config.pickle file in .cache is not getting updated when a mkdocs.yml file in a project is changed.

Related links

Reproduction

9.4.8+insiders.4.43.0-projects-plugin-cache.zip

Steps to reproduce

  1. rm -rf .cache
  2. mkdocs serve
  3. Open subproject in a browser and observe that the project has an indigo palette
  4. In another window, edit the project’s mkdocs.yml to set the palette to red
  5. Make a change to the docs/index.md to see that the browser updates
  6. You will see that while the change from (5) shows, the palette is still indigo
  7. Restart mkdocs serve
  8. Observe that the color scheme still has not changed.
  9. Stop mkdocs serve
  10. rm -rf .cache
  11. Start mkdocs serve
  12. Observe that the color scheme has changed now.

Btw. I selected a browser below without thinking and it seems this selection cannot be reset?

Browser

Other

Before submitting

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Fixed in f1cb613. I did a rewrite of the plugin and changed the approach to caching, so the workaround suggested in https://github.com/squidfunk/mkdocs-material/issues/6306#issuecomment-1798206523 is no longer needed. Also see https://github.com/squidfunk/mkdocs-material/issues/6399#issuecomment-1849020584 to learn what the rewrite solved as well.

I wanted to wait with the next release until I finished the refactoring, but it’s gotten so big, I needed to get it out before it wouldn’t fit through the door anymore. I’ll continue working on this and I’m close to having a working version fixing the caching issues and improving the overall structure of the plugin.

Did a quick test by modifying the mkdocs.yml files in one of our examples and it did get picked up. Thanks for fixing this. I will try and do some more work with the projects plugin in the coming days and will report any remaining issues I find but this fix and the other one that helped with newly created projects or those that do not use Material fix the two issues I had some across - IIRC.

The cache must be created - we need a way to store intermediate results. This is the same for all plugins. What we could do in theory (but I haven’t done it, because nobody complained) is to create a temporary directory and use that for intermediate storage, but the plugins definitely need intermediate storage. Thus, cache disables cache usage, not the cache itself.

I’ll investigate as soon as possible.