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(angular-query-experimental): allow returning undefined in initialData function #7351

Merged

Conversation

ShacharHarshuv
Copy link
Contributor

@ShacharHarshuv ShacharHarshuv commented Apr 29, 2024

Fix incorrect types that disallowed that. This is necessary because the initialData function can typically read cache synchronously and need to be able to signal to the query if there is a cache miss and an actual fetch needs to be deployed.

Fixes #7341

No breaking changes, any code that worked before should work now as well.

Copy link

vercel bot commented Apr 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview May 8, 2024 6:29pm

Copy link

codesandbox-ci bot commented Apr 29, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4cfa6ff:

Sandbox Source
@tanstack/query-example-angular-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-svelte-basic Configuration
@tanstack/query-example-vue-basic Configuration

@ShacharHarshuv
Copy link
Contributor Author

It seems like the styling changes were done automatically on commit by lint-staged. Let me know if you think something in my set up is wrong and it shouldn't have happened.

@ShacharHarshuv ShacharHarshuv force-pushed the initialData-should-allow-undefined branch from fc00927 to f579962 Compare April 29, 2024 18:57
@ShacharHarshuv
Copy link
Contributor Author

I fixed the prettier issue

@ShacharHarshuv ShacharHarshuv force-pushed the initialData-should-allow-undefined branch from f579962 to 97f4a62 Compare April 29, 2024 19:43
Copy link
Collaborator

@TkDodo TkDodo left a comment

Choose a reason for hiding this comment

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

can you please fix it for react-query adapter as well, and also have the test there? Thanks 🙏

@ShacharHarshuv
Copy link
Contributor Author

@TkDodo Done!

Copy link

nx-cloud bot commented Apr 29, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 80053f1. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 2 targets

Sent with 💌 from NxCloud.

@ShacharHarshuv
Copy link
Contributor Author

@TkDodo @arnoud-dv Can this be merged?

@ShacharHarshuv ShacharHarshuv force-pushed the initialData-should-allow-undefined branch from eba777f to 4cfa6ff Compare May 8, 2024 18:29
@arnoud-dv
Copy link
Collaborator

Looks good to me, @TkDodo agree if we merge this?

@TkDodo
Copy link
Collaborator

TkDodo commented Aug 1, 2024

sorry, this somehow slipped through my queue. will merge now.

Copy link

pkg-pr-new bot commented Aug 1, 2024

commit: 80053f1

pnpm add https://pkg.pr.new/@tanstack/angular-query-devtools-experimental@7351
pnpm add https://pkg.pr.new/@tanstack/angular-query-experimental@7351
pnpm add https://pkg.pr.new/@tanstack/eslint-plugin-query@7351
pnpm add https://pkg.pr.new/@tanstack/query-async-storage-persister@7351
pnpm add https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@7351
pnpm add https://pkg.pr.new/@tanstack/query-core@7351
pnpm add https://pkg.pr.new/@tanstack/query-devtools@7351
pnpm add https://pkg.pr.new/@tanstack/query-persist-client-core@7351
pnpm add https://pkg.pr.new/@tanstack/query-sync-storage-persister@7351
pnpm add https://pkg.pr.new/@tanstack/react-query@7351
pnpm add https://pkg.pr.new/@tanstack/react-query-devtools@7351
pnpm add https://pkg.pr.new/@tanstack/react-query-next-experimental@7351
pnpm add https://pkg.pr.new/@tanstack/react-query-persist-client@7351
pnpm add https://pkg.pr.new/@tanstack/solid-query@7351
pnpm add https://pkg.pr.new/@tanstack/solid-query-devtools@7351
pnpm add https://pkg.pr.new/@tanstack/solid-query-persist-client@7351
pnpm add https://pkg.pr.new/@tanstack/svelte-query@7351
pnpm add https://pkg.pr.new/@tanstack/svelte-query-devtools@7351
pnpm add https://pkg.pr.new/@tanstack/svelte-query-persist-client@7351
pnpm add https://pkg.pr.new/@tanstack/vue-query@7351
pnpm add https://pkg.pr.new/@tanstack/vue-query-devtools@7351

Open in Stackblitz

More templates

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.

queryOptions should to pass initialData with a callback that is potentially returning undefined
3 participants