-
Notifications
You must be signed in to change notification settings - Fork 396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected Component Lifecycle on LWC OSS in native Shadow DOM mode #1452
Comments
@jmpisson there might be something going on here... let me loop in @ravijayaramappa who is working on this area at the moment. There are a couple of things:
|
Investigation summary: The insertion hooks for custom elements inserts a given node first, then inserts its children(slot content) and then invokes the insertCustomElmHook for the given vnode.
In synthetic mode, we have some special logic for handling slot content which makes sure the slot content() is not processed as the children of the slotted parent().
lwc/packages/@lwc/engine/src/framework/hooks.ts Lines 189 to 194 in 7618597
|
This should be solved with the node-reactions proposal salesforce/lwc-rfcs#11 which guarantees that lifecycle callbacks are processed synchronously immediately after an element is connected to the DOM. Reference PR: #1431 |
AIUI this issue is fixed, and may be further fixed by #3198. Closing for now, please reopen as necessary. |
Description
In native shadow DOM mode, the component lifecycle of slot content and the slot receiver is not running in the sequence expected.
Steps to Reproduce
Considering my-app as the Root Component inside LWC project, we have two components, Parent and Child, in the app markup:
my/app/app.html
my/parent/parent.html
my/parent/parent.js
my/child/child.html
my/child/child.js
Load the page and see the JavaScript Console Output
Playground link
Run with Native Shadow DOM option selected
https://playground.lwcjs.org/projects/3-XFTm3xZ/2/edit
Expected Results
Console Output:
Expected behavior in native web components: https://jsbin.com/vavenef/edit?html,js,console
Actual Results
Console Output:
Browsers Affected
Firefox 68.173.0.3683.75 built on Debian buster/sid, running on Debian 10.0 (64-bit)
Chromium 73.0.3683.75 (Developer Build) built on Debian buster/sid, running on Debian 10.0 (64-bit)
Gnome Web 3.32 built on Debian buster/sid, running on Debian 10.0 (64-bit)
Version
Node project
"lwc-services": "^1.2.2"
The text was updated successfully, but these errors were encountered: