Open liamdebeasi opened 2 years ago
As per conversations on Slack, the main issue here appears to be that Stencil's connectedCallback
can fire before the Web Component is registered with the Custom Elements registry. I can reproduce this on Stencil 2.6.0 as well.
edit: To test with Stencil 2.6.0, install this dev build of @ionic/core
: 6.0.0-dev.202109131817.d1763fc
connectedCallback is behaving as expected.
I think one option for better more reliable support is to add a new, later lifecycle event, but there may be performance implications we'd need to research.
I am unable to reproduce the watcher issue with the above steps when using @ionic/vue@6.0.0-rc.0
(CE build), where node_modules
is using @stencil@2.9.0
.
@liamdebeasi's test repo is 404, so here is mine. Copied from CodeSandbox in the original FW issue: https://github.com/willmartian/test-ce-watcher
Prequisites
Stencil Version
2.8.0
Current Behavior
Watchers on state variables are not fired when using the custom elements build. This causes an issue in Ionic v6 where
ion-menu
is not shown because it depends onion-split-pane
emitting an event that is only fired when itsvisible
state variable is changed.Expected Behavior
I would expect that watchers fire callbacks in the custom elements build just as they would in the lazy loaded build.
Steps to Reproduce
npm install
and thennpm run start
.ion-split-pane
andion-menu
components in the DOM, but theion-menu
component is not visible. (You should not see the "menu content" text)node_modules/@ionic/core/components/ion-split-pane.js
this.visible
after line 57. (Right before the "// Check if the split-pane is disabled" comment)this.visible
after line 84. (Right before the function ends)visibleChanged
method, which is the callback that is fired whenthis.visible
changes.this.visible
changes fromfalse
totrue
, but thevisibleChanged
method is never fired.Code Reproduction URL
https://github.com/liamdebeasi/ce-build-watcher
Additional Information
Ionic GH Issue: https://github.com/ionic-team/ionic-framework/issues/23876