-
Notifications
You must be signed in to change notification settings - Fork 100
help: setting a non-reactive const with useFetch() #36
Comments
So you want to use When this vuejs/composition-api#311 gets merged we can create a |
@pooledge Presumably you want this to be reactive on server, so that you get the correct HTML rendered after the fetch completes, but completely non-reactive on client? |
I have to admit at this point I am not sure anymore what my worst enemy is. Do any of the following assumptions make sense to you?
I guess to better understand the problem, more measurements have to be made in the client. I'll try to compare the Apollo setup I mentioned earlier with something like a sample of what I have in Nuxt right now. @danielroe @mathe42 thank you for your inputs! |
I'm currently working on const _ref = shallowSsrRef(null)
if(!_ref) {
useFetch(() => {
_ref.value = await fetcher('Hello World')
})
}
// on client after ssr
console.log(_ref) // 'Hello World' const _ref = shallowSsrRef({ test: 'Hello' })
if(_ref.test === 'Hello') {
useFetch(() => {
_ref.value.test = await fetcher('World')
})
}
// on client after ssr
console.log(_ref.value) // 'Hello' |
@pooledge Now merged and released as |
FOA thanks for the module, was looking for this!
📚 What are you trying to do? Please describe.
I'd like to set a
const items[]
as a result of theuseFetch()
. I explicitly want items array to be non-reactive to prevent performance issues while observing a huge array.Using Apollo in a regular Vue CLI app I'm able to achieve this with:
so while
result
is not set, I can useloading
. I see there is no simple way to achieve this.My global aim is to refactor an existing Nuxt.js app with less reactivity. Am I looking to the right direction at all?
Oh and BTW, a check for
globalName
from the Nuxt config would be nice )The text was updated successfully, but these errors were encountered: