graphql-code-generator-community icon indicating copy to clipboard operation
graphql-code-generator-community copied to clipboard

fix: Query keys should be shared between suspense and not suspense

Open alumbo opened this issue 9 months ago • 5 comments
trafficstars

🚨 IMPORTANT: Please do not create a Pull Request without creating an issue first.

Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.

Description

Query keys should be shared between suspense and non-suspense hooks to ensure consistent state management and synchronization, preventing discrepancies and maintaining a single source of truth for query invalidation.

Related # (issue)

Type of change

Please delete options that are not relevant.

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [X] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

Screenshots/Sandbox (if appropriate/relevant):

Adding links to sandbox or providing screenshots can help us understand more about this PR and take action on it as appropriate

Checklist:

  • [X] I have followed the CONTRIBUTING doc and the style guidelines of this project
  • [X] I have performed a self-review of my own code
  • [X] I have commented my code, particularly in hard-to-understand areas
  • [X] I have made corresponding changes to the documentation
  • [X] My changes generate no new warnings
  • [X] I have added tests that prove my fix is effective or that my feature works
  • [X] New and existing unit tests pass locally with my changes
  • [X] Any dependent changes have been merged and published in downstream modules

alumbo avatar Jan 30 '25 10:01 alumbo

⚠️ No Changeset found

Latest commit: 1a5c52fb87a6b81114a47f3b66cbad6e9e2a30e2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Jan 30 '25 10:01 changeset-bot[bot]

Could we please merge asap this PR to fix this wrong key ?

useSuspensePosts and usePosts should have the same key to not break the cache.

viclafouch avatar Feb 03 '25 15:02 viclafouch

I experienced the same issue, waiting to fix the PR to clean up the codebase.

dohomi avatar Feb 04 '25 00:02 dohomi

Hi, could this be reviewed and merged ASAP? It seems to be related to this issue: https://github.com/dotansimha/graphql-code-generator-community/issues/875

stefan-bozic-ananas avatar Feb 14 '25 11:02 stefan-bozic-ananas

Any chance to merge this PR? Its quite important change to share the query key

dohomi avatar May 10 '25 05:05 dohomi

This PR would greatly improve shared query keys for the same data. Anyone can merge this as its a non-breaking change?

dohomi avatar Jun 19 '25 00:06 dohomi

@eddeee888 any chance you could have a look at this? Thanks!

dohomi avatar Jun 23 '25 00:06 dohomi