feat: extend hook revalidation keys to remaining hooks#83
Open
utopyin wants to merge 1 commit intouseautumn:mainfrom
Open
feat: extend hook revalidation keys to remaining hooks#83utopyin wants to merge 1 commit intouseautumn:mainfrom
utopyin wants to merge 1 commit intouseautumn:mainfrom
Conversation
|
@utopyin is attempting to deploy a commit to the Autumn Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extends the hook revalidation-key pattern from PR #82 "feat: add extraQueryKeys param" to the rest of the SWR-backed hooks.
Specifically, it adds support for:
extraQueryKeys?: (string | null | undefined)[]and appends those keys to SWR query keys so consumers can trigger declarative refetches when external values change.
Changes
extraQueryKeyssupport to:usePaywalluseListEventsuseAggregateEventsuseAnalyticsuseProductsBaseusePricingTableBaseusePricingTable(react + next wrappers via shared param typing)useListEvents,useAggregateEvents,useAnalytics).Open question
I did run
pnpm installand found out the lock file was not up to date. Should I remove it from the patch?AI Disclaimer
Part of this code has been generated with the help of Codex. I reviewed the entirety of the patch.
Summary by cubic
Extends extraQueryKeys to all SWR-backed hooks so apps can trigger refetches when external values change. Also stops non-API fields from being sent to the server.
New Features
Bug Fixes
Written for commit 4a08fab. Summary will update on new commits.
Greptile Summary
This PR successfully extends the
extraQueryKeyspattern from PR #82 to all remaining SWR-backed hooks, enabling declarative cache revalidation when external values change.Key Changes:
extraQueryKeys?: (string | null | undefined)[]parameter tousePaywall,useListEvents,useAggregateEvents,useAnalytics,useProductsBase, andusePricingTableBaseuseListEvents,useAggregateEvents,useAnalytics) ensures non-API fields aren't forwarded to backendUsePricingTableParamsinterface used consistently across React and Next.jsusePricingTablewrappersImplementation Quality:
The implementation follows the established pattern correctly. All hooks properly append
extraQueryKeysto their SWR query keys using the spread operator with nullish coalescing (...(extraQueryKeys ?? [])). Hooks that make API calls properly destructureextraQueryKeysandswrConfigto prevent them from being forwarded to the backend.Regarding pnpm-lock.yaml:
The lockfile changes (7,479 deletions) appear to be dependency cleanup from running
pnpm install, which is unrelated to the feature implementation. Consider whether these changes should be in a separate commit or PR to keep the feature changes focused.Confidence Score: 5/5
extraQueryKeysparameter, and hooks with API calls properly prevent non-API fields from being forwarded. No logical errors or breaking changes detected.Important Files Changed
extraQueryKeysparameter following the established pattern, properly prevents forwarding to APIextraQueryKeysparameter with proper destructuring to prevent API forwardingextraQueryKeysparameter, correctly destructured alongsideswrConfigto avoid API forwardingextraQueryKeysparameter and appended to query key for cache invalidationUsePricingTableParamsinterface withextraQueryKeysand updated query key generationpnpm install- unrelated to feature changesLast reviewed commit: 4a08fab