Skip to content
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

Add repo href to source facts cache key #7925

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

monoxgas
Copy link

I propose extending the __source cache key used for saving repo source facts in watchSource to include the .href of the associated anchor element.

This is useful for cases where we are overriding/updating the repo_url link between different pages on the same site (useful for mono/multi-repo scenarios). As it currently stands, the cache will always hit if any repo facts have ever been queried and gives no consideration for caching per-distinct repo - resulting in the return of facts for the first rendered Source component for all others.

I had also considered using _md_hash() on the .href to reduce noise in the cache key, but I think it's best that @squidfunk make any final calls on what/how to make the cache value distinct - open to suggestions.

Potential side-effects:

  • Existing facts cached under the generic __source are not removed or modified
  • The change would force a one-time re-query for facts in existing sites once updated

@squidfunk
Copy link
Owner

Thanks for the PR. In order for us to decide on whether this can be merged, could I ask you to please provide a minimal reproduction that showcases the problem you're aiming to solve? It's easier for us to analyze and understand the implications. Also, we can test the behavior before/after.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants