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
Just thought about the issue and always I looked into the implementation I ask myself: "Why is the WeakMap necessary at all?"
Why not simply store the hostRef directly on the Node?
@danielleroux because Stencil, for the dist output, needs a way to connect lazy loaded class instances with their corresponding elements.
Your proposal could potentially work for the dist-custom-elements output though as the class instance and element is 1:1 but might end up with causing more overall complexity idk
@danielleroux because Stencil, for the dist output, needs a way to connect lazy loaded class instances with their corresponding elements. Your proposal could potentially work for the dist-custom-elements output though as the class instance and element is 1:1 but might end up with causing more overall complexity idk
Got it, but could we do some similar hand over the hostRef after the class instance is loaded? Regarding the complexity you might be correct 😶🌫️
Got it, but could we do some similar hand over the hostRef after the class instance is loaded? Regarding the complexity you might be correct 😶🌫️
I think the connection needs to be 'live' to enable stuff like:
some internal state updates a class instance's @Prop() which needs to be reflected - we need to find the corresponding element to update or (vice versa) ....
some element.setAttribute(...) occurs on the element, we need to find the corresponding class instance to update it's internal state.
^ in these cases, the map acts as a live bridge to keep the 2 in-sync.
Got it, but could we do some similar hand over the hostRef after the class instance is loaded? Regarding the complexity you might be correct 😶🌫️
I think the connection needs to be 'live' to enable stuff like:
some internal state updates a class instance's @Prop() which needs to be reflected - we need to find the corresponding element to update or (vice versa) ....
some element.setAttribute(...) occurs on the element, we need to find the corresponding class instance to update it's internal state.
^ in these cases, the map acts as a live bridge to keep the 2 in-sync.
Good call have to check this. Just for testing around I made some quick and dirty changes (main...danielleroux:stencil:poc-host-refs). Works with default scenarios (dist and dist-custom-elements) but dont checked the memory if we have some leaks there now again)
Good call have to check this. Just for testing around I made some quick and dirty changes (main...danielleroux:stencil:poc-host-refs). Works with default scenarios (dist and dist-custom-elements) but dont checked the memory if we have some leaks there now again)
Nice! I think it looks sensible / should work ... in my head it should anyway 😅
Good call have to check this. Just for testing around I made some quick and dirty changes (main...danielleroux:stencil:poc-host-refs). Works with default scenarios (dist and dist-custom-elements) but dont checked the memory if we have some leaks there now again)
Nice! I think it looks sensible / should work ... in my head it should anyway 😅
Any advice to proceed? Should I fix the typings (remove any casts) and open a PR or do we need any further analysis regarding ionic-framework? I checked the code for detached DOM nodes but it looks fine.
We are facing the error also during testing with react output target (dist-custom-elements) and testing-framework. All tests are failing because of the undefined instance reference.
@danielleroux - awesome!
Next steps - tidy up, do all the admin (prettier, lint, run spec tests (npm run test.watch), wdio tests (npm run test.wdio) e2e tests (npm run test.end-to-end)) and make a PR - we'll see if anyone has any feedback and can take it for a test-drive :)
Activity
danielleroux commentedon Feb 6, 2025
Just thought about the issue and always I looked into the implementation I ask myself: "Why is the WeakMap necessary at all?"
Why not simply store the hostRef directly on the Node?
e.g
johnjenkins commentedon Feb 6, 2025
@danielleroux because Stencil, for the
distoutput, needs a way to connect lazy loaded class instances with their corresponding elements.Your proposal could potentially work for the
dist-custom-elementsoutput though as the class instance and element is 1:1 but might end up with causing more overall complexity idkdanielleroux commentedon Feb 6, 2025
Got it, but could we do some similar hand over the hostRef after the class instance is loaded? Regarding the complexity you might be correct 😶🌫️
johnjenkins commentedon Feb 6, 2025
I think the connection needs to be 'live' to enable stuff like:
@Prop()which needs to be reflected - we need to find the corresponding element to update or (vice versa) ....element.setAttribute(...)occurs on the element, we need to find the corresponding class instance to update it's internal state.^ in these cases, the map acts as a live bridge to keep the 2 in-sync.
danielleroux commentedon Feb 6, 2025
Good call have to check this. Just for testing around I made some quick and dirty changes (main...danielleroux:stencil:poc-host-refs). Works with default scenarios (dist and dist-custom-elements) but dont checked the memory if we have some leaks there now again)
johnjenkins commentedon Feb 6, 2025
Nice! I think it looks sensible / should work ... in my head it should anyway 😅
danielleroux commentedon Feb 11, 2025
Any advice to proceed? Should I fix the typings (remove any casts) and open a PR or do we need any further analysis regarding ionic-framework? I checked the code for detached DOM nodes but it looks fine.
We are facing the error also during testing with react output target (dist-custom-elements) and testing-framework. All tests are failing because of the undefined instance reference.
johnjenkins commentedon Feb 11, 2025
@danielleroux - awesome!
Next steps - tidy up, do all the admin (prettier, lint, run spec tests (
npm run test.watch), wdio tests (npm run test.wdio) e2e tests (npm run test.end-to-end)) and make a PR - we'll see if anyone has any feedback and can take it for a test-drive :)christian-bromann commentedon Feb 11, 2025
@johnjenkins let me know if you want me to make dev releases of certain branches for testing.
johnjenkins commentedon Feb 11, 2025
good to know! (@danielleroux ^)