Skip to content
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

createProtobufSafeUpdater and useInfiniteQuery? #517

Open
tatsmaki opened this issue Feb 6, 2025 · 1 comment · May be fixed by #518
Open

createProtobufSafeUpdater and useInfiniteQuery? #517

tatsmaki opened this issue Feb 6, 2025 · 1 comment · May be fixed by #518

Comments

@tatsmaki
Copy link

tatsmaki commented Feb 6, 2025

types provided from createProtobufSafeUpdater are incompatible with actual data from infinite query

createProtobufSafeUpdater says it will be QUERY_RESPONSE_TYPE but in reality the type is InfiniteData<QUERY_RESPONSE_TYPE>

const queryClient = useQueryClient();

const mutation = useMutation(MUTATION_DESCRIPTOR, {
    onSuccess() {
        const updater = createProtobufSafeUpdater(QUERY_DESCRIPTOR, (prevData?: InfiniteData<QUERY_RESPONSE_TYPE>) => {
              return prevData
        });

        queryClient.setQueriesData({ queryKey: QUERY_KEY }, updater);
    },
});

Is there a way to provide correct types/arguments?

@paul-sachs
Copy link
Collaborator

Yes this seems to be a gap in our API. Will need to investigate to see if there are any sharp corners to this one.

@paul-sachs paul-sachs linked a pull request Feb 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants