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 reading the source code for apiCustomElement.ts to better understand how provide/inject works in custom elements.
I've noticed that in _resolveDef method property _resolved is assigned to true before it is actually resolved. Since that property is queried in connectedCallback, I've wondered if I can move element before it is actually resolved, and that if that would force resolve method to run immediately. Sure enough it did.
However, this did not break rendering of the element, so it seems that render function handles different types of vnodes correctly (vnode.type returns different values, which probably also shouldn't be the case). But since internal Vue instance is created before definition was loaded, it does not know what values to provide
The text was updated successfully, but these errors were encountered:
Vue version
3.2.47
Link to minimal reproduction
https://stackblitz.com/edit/vite-m1kzad?file=main.js
Steps to reproduce
provided value
setTimeout
default value
What is expected?
Both times
provided value
should be renderedWhat is actually happening?
default value
is rendered second time insteadSystem Info
No response
Any additional comments?
I was reading the source code for
apiCustomElement.ts
to better understand how provide/inject works in custom elements.I've noticed that in
_resolveDef
method property_resolved
is assigned totrue
before it is actually resolved. Since that property is queried inconnectedCallback
, I've wondered if I can move element before it is actually resolved, and that if that would forceresolve
method to run immediately. Sure enough it did.However, this did not break rendering of the element, so it seems that render function handles different types of vnodes correctly (
vnode.type
returns different values, which probably also shouldn't be the case). But since internal Vue instance is created before definition was loaded, it does not know what values to provideThe text was updated successfully, but these errors were encountered: