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

feat: make the cache adjustable through the visit object #73

Merged
merged 4 commits into from
Apr 13, 2024

Conversation

hirasso
Copy link
Member

@hirasso hirasso commented Apr 12, 2024

Description

Allows to adjust the cache for form submissions:

swup.hooks.on("visit:start", (visit) => {
  if (visit.trigger.el?.matches('.my-filter-form')) {
    visit.cache.read = true;
  }
});

or simply:

swup.hooks.on("visit:start", (visit) => {
  visit.cache.read = true;
});

Drive By

  • npm update
  • add contributors to package.json

Checks

  • The PR is submitted to the master branch
  • The code was linted before pushing (npm run lint)

@hirasso hirasso requested a review from daun April 12, 2024 18:47
@daun
Copy link
Member

daun commented Apr 12, 2024

Am I understanding this right? Clearing the cache currently makes it impossible to allow reading from the cache, and this change replicates the current behavior but allows manipulating the cache settings on the fly?

@daun
Copy link
Member

daun commented Apr 12, 2024

Just re-read the issue, I get it now. I'm assuming you've tested this. Code looks fine!

@hirasso hirasso merged commit d675657 into master Apr 13, 2024
@hirasso hirasso deleted the feat/make-cache-adjustable branch April 13, 2024 05:24
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.

None yet

2 participants