Uh oh!
There was an error while loading. Please reload this page.
fix(nuxt): warn to provide a key for useFetch with transform option - #4590
Conversation
✅ Deploy Preview for nuxt3-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
pi0
commented
Apr 25, 2022
I think we can exclude options that are not related to fetch like transform from hash transformation. hashing it to distinguish by request. |
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Sébastien Chopin <seb@nuxtjs.com>
danielroe
commented
Apr 26, 2022
I would say that transform should make a difference to the hash. Consider: awaituseFetch('/api/test',{transform: data=>data[0]})awaituseFetch('/api/test')These two calls will result in different data, and if we don't enforce a key generation then there's a danger of mismatching payloads. |
pi0
commented
Apr 26, 2022
Okay i'm fine with adding warning until find a better way for auto hashing. Can we in the meantime remove |
useFetch with transform optionuseFetch with transform optionuseFetch with transform option
🔗 Linked issue
resolvesnuxt/nuxt#13790
❓ Type of change
📚 Description
This PR addresses two issues:
.toString()differs between server/client so the generated key (fromohash) doesn't match.Other options:
It feels like the safest option is to require a user to provide a custom key in the event of using
transform.📝 Checklist