-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
since the update to v2 and nuxt v4, we see some entries in sentry like
undefined is not an object (evaluating 'g.data.value.data')
coming from this line
https://github.com/nuxt-modules/sanity/blob/main/src/runtime/composables/useSanityQuery.ts#L166
It happens when client.fetch for whatever reason fails, so there is no value.data.value, and we can't catch it because it happens in result.then.
Anyway it happens rarely, but it would be nice if it would not crash.
Version
module: 2.0.0
nuxt: 4.2.0
Reproduction
just block the sanity domain in dev tools, and try to load another page client side
What is expected?
the error handled or at least passed to the caller
What is actually happening?
error thrown
useSanityQuery.js:114 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data')
at useSanityQuery.js:114:35
Steps to reproduce
Additional information
Checklist
- I have tested with the latest Nuxt version and the issue still occurs
- I have tested with the latest module version and the issue still occurs
- I have searched the issue tracker and this issue hasn't been reported yet
Steps to reproduce
- open a nuxt page
- block sanity domain on the network tab of dev tools
- try to access another page
- observe the error thrown and there's not much you can do it about it
vin-ni, devzom and martin-ctny
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working