feat(cache): add allowQuery option to filter query params in cache key#4079
feat(cache): add allowQuery option to filter query params in cache key#4079fmoessle wants to merge 3 commits intonitrojs:v2from
allowQuery option to filter query params in cache key#4079Conversation
Allow users to specify which query parameters should be included in the cache key via `allowQuery` option on `defineCachedEventHandler` and route rules cache config. - `undefined`: all query params included (default, no behavior change) - `[]`: all query params ignored (only pathname used) - `["q"]`: only listed params included Closes nuxt/nuxt#33728 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@fmoessle is attempting to deploy a commit to the Nitro Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Route rules config passes `allowQuery` as `readonly string[]`, so the type needs to accept both mutable and readonly arrays (matching `varies`). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
commit: |
Summary
allowQueryoption todefineCachedEventHandlerand route rulescacheconfig[], all query parameters are ignored (only pathname is used)undefined(default), all query parameters are included — no behavior changeutm_source,fbclid, etc.Closes nuxt/nuxt#33728
Test plan
api/cached-allow-query.tswithallowQuery: ["q"]/rules/allow-query/**withallowQuery: ["q"]qparam with different unlisted params hits cacheqparam gets different cache entryallowQueryfield🤖 Generated with Claude Code