You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to implement Redis for component caching. But due to the type of data passed to set method it is impossible to parse it as a string and store it in a cache. Redis is just removing components property:
And it break vue-server-renderer, because it expects components to be there:
// node_modules/vue-server-renderer/build.dev.js:8399:26get(key,function(res){console.log({vsr_res_components: res?.components});if(isDef(res)){if(isDef(registerComponent)){registerComponent(userContext);}res.components.forEach(function(register){returnregister(userContext);});// this breaks, because components are parsed to an empty objectwrite(res.html,next);}else{renderComponentWithCache(node,isRoot,key,context);}});
Vue docs are suggesting that this should be possible, by even giving an example:
constrenderer=createRenderer({cache: {get: (key,cb)=>{redisClient.get(key,(err,res)=>{// handle error if anycb(res)})},set: (key,val)=>{redisClient.set(key,val)// but this does not work, as `val` is an object with Set and functions instead of a string, and it can not be stored in Redis}}})
I implemented it like this, but it does not work. I also couldn't find any example of working component caching with Redis. Is this even possible?
The text was updated successfully, but these errors were encountered:
Vue version
2.6.14
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-6m9sxj?file=server.js
Steps to reproduce
set
method insidecreateRenderer
cacheWhat is expected?
According to vue documentation
set
method should receive second argument as a string:So
val
should have typestring
What is actually happening?
Method
set
receives an object with this structure:System Info
No response
Any additional comments?
I was trying to implement Redis for component caching. But due to the type of data passed to
set
method it is impossible to parse it as a string and store it in a cache. Redis is just removingcomponents
property:And it break
vue-server-renderer
, because it expects components to be there:Vue docs are suggesting that this should be possible, by even giving an example:
I implemented it like this, but it does not work. I also couldn't find any example of working component caching with Redis. Is this even possible?
The text was updated successfully, but these errors were encountered: