-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix(ktabledata): fetcher cache key should respect fetcher params #2531
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for kongponents-sandbox ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for kongponents ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
.should('returned', { data: [{ query: '' }] }) | ||
// fetcher should not be called as this state is already cached | ||
cy.get('@fetcher', { timeout: 1000 }) | ||
.should('have.callCount', 2) // fetcher's 3rd call |
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.
.should('have.callCount', 2) // fetcher's 3rd call | |
.should('have.callCount', 2) // fetcher's 2nd call |
@@ -767,19 +768,20 @@ describe('KTableData', () => { | |||
cy.get('.table tbody').find('tr').should('have.length', 2) | |||
cy.get('.table tbody').should('contain.text', 'row10') | |||
cy.get('@fetcher') | |||
.should('have.callCount', 3) | |||
// TODO: Investigate why fetcher is called twice here |
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.
I did some debugging and it turns out when switching to next page, besides the request fired by swrv triggered by the change of fetcherParams
, this line watch([query, page, pageSize], async (newData, oldData) =>
in KTableData
already implements the debounced refetch strategy when any of query
, page
, pageSize
is changing. I think you can either exclude these params from identifierKey
or remove the current watcher of these params by replacing its functionality with swrv
Preview package from this PR in consuming applicationIn consuming application project install preview version of kongponents generated by this PR:
|
Summary
Fetcher cache key should reflect fetcher params.