Skip to content

Is it possible to use a mutation return value to patch an infinite query? #5021

Answered by steinarb
steinarb asked this question in Q&A
Discussion options

You must be logged in to vote

I transformed this query into

        getJobs: builder.query({ query: (accountId) => '/jobs/' + accountId.toString(), providesTags: ['JobRegistered', 'PaymentRegistered'] }),

this infinite query.

        getJobs: builder.infiniteQuery({
            infiniteQueryOptions: {
                initialPageParam: 0,
                getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) => lastPageParam + 1,
            },
            query: ({ queryArg, pageParam }) => '/jobs/' + queryArg.toString() + '?pagenumber=' + pageParam, providesTags: ['JobRegistered', 'PaymentRegistered']
        }),

I had this mutation that updated the original query

        postJobsDelete: builder.mutat…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@steinarb
Comment options

Answer selected by steinarb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants