Subscribe on changes!

useCssVars throw error when instance.subTree is null

avatar
Nov 3rd 2022

Vue version

3.2.41

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-4m67zb?file=src/App.vue SFC

Steps to reproduce

  • Make component to use v-bind in css
  • Pass slot where error throws

What is expected?

Expect only ''Error: a" shown as error

What is actually happening?

Throws "TypeError: can't access property "shapeFlag", vnode is null" in addition to "a"

System Info

No response

Any additional comments?

Should be easy to fix.

const setVars = () => instance.subTree && setVarsOnVNode(instance.subTree, getter(instance.proxy));

Originally come from here: https://github.com/epicmaxco/vuestic-ui/issues/2614

avatar
Nov 3rd 2022

A computed property (or your template) shouldn't throw an error. If you have a realistic reproduction that does create the same situation, please share it.

I checked the issue you linked and the problem is the Error global is not available in the template. I'm not sure if this is intentional so I opened https://github.com/vuejs/core/pull/7018