Skip to content

Conversation

@IAMOTZ
Copy link
Contributor

@IAMOTZ IAMOTZ commented Jun 5, 2021

ISSUE:
query.data is always undefined at initial render; because of this the data.hasMore check in the "Next Page" button throws a type error(TypeError: Cannot read property 'hasMore' of undefined) and crashes the whole thing on app launch.

FIX:
I'm using javascript optional chaining to check if there is a data object before accessing the hasMore property - this fixes the type error and the code works fine.

`query.data` is always `undefined` at initial render; because of this the `data.hasMore` check in the "Next Page" button throws a type error when this mini-app launches(`TypeError: Cannot read property 'hasMore' of undefined`) and crashes the whole thing. I'm using javascript optional chaning to check if there is a data object before accessing the `hasMore` property - this fixes the type error and the mini-app works fine.
@vercel
Copy link

vercel bot commented Jun 5, 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/HB47yaYkiDDcHrMHfgudtAKWn5p9
✅ Preview: https://react-query-git-fork-iamotz-patch-1-tannerlinsley.vercel.app

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 5, 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 efa41e9:

Sandbox Source
tannerlinsley/react-query: basic Configuration
tannerlinsley/react-query: basic-typescript Configuration

@TkDodo TkDodo merged commit f00de49 into TanStack:master Jun 7, 2021
@tannerlinsley
Copy link
Member

🎉 This PR is included in version 3.17.0 🎉

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.

3 participants