Skip to content

Conversation

@TuckerWhitehouse
Copy link
Contributor

Providing a defaultConfig to makeQueryCache will merge shared, queries, and mutations
objects instead of overwriting. This allows you to configure only some options.

Providing a `defaultConfig` to `makeQueryCache` will merge `shared`, `queries`, and `mutations`
objects instead of overwriting. This allows you to configure only some options.
@vercel
Copy link

vercel bot commented Jul 17, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tannerlinsley/react-query/aafyjq3px
✅ Preview: https://react-query-git-fork-tuckerwhitehouse-default-config-merging.tannerlinsley.vercel.app


expect(() => queryCache.buildQuery('test')).not.toThrow(
'config.queryKeySerializerFn is not a function'
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Open to suggestions on a better way to validate this -- I started by writing this test expecting the exception because that is the current behavior, switched to .not.toThrow and applied my code changes.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure either. But we can make it better in the future if we need to. If tests pass and you think this is good enough, then let me know and I'll merge :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you're happy with it, the tests pass and it resolves the issue I was having :)
I had also considered exposing configRef on the queryCache but wasn't sure if increasing the public api to support testing was a good idea 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I'd rather not expose more api lol. I'm doing too much of that as it is.

@tannerlinsley tannerlinsley merged commit 7ac9238 into TanStack:master Jul 17, 2020
@tannerlinsley
Copy link
Member

🎉 This PR is included in version 2.5.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants