resolveComponent() Inside Computed Property no longer works in Vue 3.4 #10884
-
I use resolveComponent within a computed property to dynamically resolve components based on certain conditions. In my application i work with OPC UA as a data source and i have to react to change in values before i can decide exactly what component i should render and what props it should have. My current solution was functioning well in version 3.3.4 but as of version 3.4 that is no longer the case. Below is a simplified version of what i do in my application. main.ts
App.vue
Environment:
Questions
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
From https://vuejs.org/api/render-function.html#resolvecomponent:
You can't safely use It's essentially the same problem I described in #9974. The reactivity system was significantly rewritten in 3.4, leading to some subtle changes to the timing of when things ran. This wasn't a change to the documented API, but code that implicitly relied on the previous timing of the calls will fail with 3.4. |
Beta Was this translation helpful? Give feedback.
From https://vuejs.org/api/render-function.html#resolvecomponent:
You can't safely use
resolveComponent
inside acomputed
, as it isn't guaranteed to be evaluated duringsetup
or rendering.It's essentially the same problem I described in #9974. The reactivity system was significantly rewritten in 3.4, leading to some subtle changes to the timing of when things ran. This wasn't a change to the documented API, but code that implicitly relied on the previous timing of the calls will fail with 3.4.