Skip to content

Conversation

@TkDodo
Copy link
Collaborator

@TkDodo TkDodo commented Apr 11, 2021

closes #1824

@vercel
Copy link

vercel bot commented Apr 11, 2021

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/6sgX1quLgqSe94HejVAF4vBvEZsV
✅ Preview: https://react-query-git-fork-tkdodo-feature-1824-transform-pl-83f15c.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 11, 2021

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 0f7a9e5:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration
React Query placeholderData with select Issue #1824

fix structural sharing, in the options, we might also have the placeholderData function, but on the previous result, we have the correct result from the previous iteration, which we want to keep if possible
if (typeof placeholderData !== 'undefined') {
status = 'success'
data = placeholderData
data = placeholderData as TData
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

not sure why I need the type assertion here - not really happy with it. placeholderData is of type TData | TQueryFnData - maybe I have the typings wrong somewhere @boschni?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Think there is no way around this. If there is no select function or behavior then placeholderData should be of type TData but TS does not know if this is the case upfront

@TkDodo TkDodo requested review from boschni and tannerlinsley April 11, 2021 12:13
@tannerlinsley
Copy link
Member

🎉 This PR is included in version 3.15.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@TkDodo TkDodo deleted the feature/1824-transform-placeholder-data-with-select branch May 8, 2021 19:20
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.

placeholderData is not transformed by select

3 participants