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

fix(react-query): move away of uSES #8434

Open
wants to merge 64 commits into
base: main
Choose a base branch
from
Open

Conversation

KATT
Copy link
Contributor

@KATT KATT commented Dec 13, 2024

Closes #8384 (I think/hope !?!!?)

Refactor @tanstack/react-query to not rely on useSyncExternalStore() as it creates issues in concurrent rendering


I think it works!? I added the repro in examples and I also tried to add a test to make it fail

Copy link

nx-cloud bot commented Dec 13, 2024

View your CI Pipeline Execution ↗ for commit 7e7d55c.

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ❌ Failed 3m 38s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 1m 2s View ↗

☁️ Nx Cloud last updated this comment at 2024-12-20 13:44:37 UTC

Copy link

pkg-pr-new bot commented Dec 13, 2024

Open in Stackblitz

More templates

@tanstack/angular-query-devtools-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@8434

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@8434

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@8434

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@8434

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@8434

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@8434

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@8434

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@8434

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@8434

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@8434

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@8434

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@8434

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@8434

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@8434

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@8434

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@8434

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@8434

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@8434

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@8434

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@8434

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@8434

commit: 7e7d55c

autofix-ci bot and others added 3 commits December 13, 2024 12:58
…/8384

# Conflicts:
#	packages/react-query/src/__tests__/useQuery.test.tsx
@@ -54,65 +54,6 @@ describe('useIsFetching', () => {
await findByText('isFetching: 0')
})

it('should not update state while rendering', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing we should just trust React to optimize re-renders? 🤷

@KATT KATT requested a review from TkDodo December 19, 2024 21:19
Comment on lines +15 to +17
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
global.IS_REACT_ACT_ENVIRONMENT = true
Copy link
Contributor Author

@KATT KATT Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +1 to +4
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to remove this, but it helps me as a contributor - I have a bunch of settings in trpc https://github.com/trpc/trpc/tree/next/.vscode

@KATT KATT marked this pull request as draft December 20, 2024 11:40
@KATT KATT marked this pull request as ready for review December 20, 2024 13:26
if (defaultedOptions.experimental_prefetchInRender) {
// Do not notify on updates because of changes in the options because
// these changes should already be reflected in the optimistic result.
observer.setOptions(defaultedOptions, { listeners: false })
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the options straight away for experimental_prefetchInRender seems to fix it.

I think the issue I had was some race condition...

I still have no reliable reproduction though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

experimental_promise: A component was suspended by an uncached promise
2 participants