-
-
Notifications
You must be signed in to change notification settings - Fork 275
docs: add contributing section about cache busting in dev #1617
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -31,6 +31,7 @@ This focus helps guide our project decisions as a community and what we choose t | |||||
| - [Setup](#setup) | ||||||
| - [Development workflow](#development-workflow) | ||||||
| - [Available commands](#available-commands) | ||||||
| - [Clearing caches during development](#clearing-caches-during-development) | ||||||
| - [Project structure](#project-structure) | ||||||
| - [Local connector CLI](#local-connector-cli) | ||||||
| - [Mock connector (for local development)](#mock-connector-for-local-development) | ||||||
|
|
@@ -124,6 +125,34 @@ pnpm test:a11y # Lighthouse accessibility audits | |||||
| pnpm test:perf # Lighthouse performance audits (CLS) | ||||||
| ``` | ||||||
|
|
||||||
| ### Clearing caches during development | ||||||
|
|
||||||
| Nitro persists `defineCachedEventHandler` results to disk at `.nuxt/cache/nitro/`. This cache **survives dev server restarts**. If you're iterating on a cached API route and want fresh results, delete the relevant cache directory: | ||||||
|
|
||||||
| ```bash | ||||||
| # Clear all Nitro handler caches | ||||||
| rm -rf .nuxt/cache/nitro/handlers/ | ||||||
|
|
||||||
| # Clear a specific handler cache (e.g. picks) | ||||||
| rm -rf .nuxt/cache/nitro/handlers/npmx-picks/ | ||||||
| ``` | ||||||
|
|
||||||
| Alternatively, you can bypass the cache entirely in development by adding `shouldBypassCache: () => import.meta.dev` to your `defineCachedEventHandler` options: | ||||||
|
|
||||||
| ```ts | ||||||
| export default defineCachedEventHandler( | ||||||
| async event => { | ||||||
| // ... | ||||||
| }, | ||||||
| { | ||||||
| maxAge: 60 * 5, | ||||||
| shouldBypassCache: () => import.meta.dev, | ||||||
| }, | ||||||
| ) | ||||||
| ``` | ||||||
|
|
||||||
| The `.cache/` directory is a separate storage mount used for fetch-cache and atproto data. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor: The note mentions the directory but leaves contributors without any guidance. Someone hitting stale fetch-cache or atproto data won't know whether or how to clear it. Consider either scoping the note ("the commands above do not affect ✏️ Suggested expansion-The `.cache/` directory is a separate storage mount used for fetch-cache and atproto data.
+The `.cache/` directory is a separate storage mount used for fetch-cache and atproto data. The commands above do not affect it; to clear it, run `rm -rf .cache/`.📝 Committable suggestion
Suggested change
|
||||||
|
|
||||||
| ### Project structure | ||||||
|
|
||||||
| ``` | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: comment label doesn't match the directory name in the example.
Line 136 says
(e.g. picks)but the path immediately below it isnpmx-picks/. Aligning the comment with the actual directory name avoids confusion.✏️ Suggested fix