Skip to content

fix(runtime): stop applying patches to non-shadow / non-render() components#6349

Merged
christian-bromann merged 6 commits intomainfrom
dont-touch-non-slot-cmps
Jul 18, 2025
Merged

fix(runtime): stop applying patches to non-shadow / non-render() components#6349
christian-bromann merged 6 commits intomainfrom
dont-touch-non-slot-cmps

Conversation

@johnjenkins
Copy link
Copy Markdown
Contributor

@johnjenkins johnjenkins commented Jul 17, 2025

What is the current behavior?

The fix applied via #6348 only partially works because Stencil automatically sets other extras like slotChildNodesFix to true when the collective experimentalSlotFixes is true

GitHub Issue Number: N/A

What is the new behavior?

A new component meta flag has been added hasRenderFn - if a non-shadow component has a render() present, it's assumed it has internals and mimics shadowDOM behaviour. If a component does not have a render() it is left untouched.

Documentation

Does this introduce a breaking change?

  • Yes
  • No

Testing

Other information

@johnjenkins johnjenkins requested a review from a team as a code owner July 17, 2025 23:13
@christian-bromann
Copy link
Copy Markdown
Member

@johnjenkins I think this is related to this change:

[chrome 138.0.7204.100 linux #0-0] 1) scoped encapsulation should return an empty string if there is no slotted content
[chrome 138.0.7204.100 linux #0-0] expect(received).toBe(expected) // Object.is equality

Expected: ""
Received: "Top content
Bottom content"
[chrome 138.0.7204.100 linux #0-0] Error: expect(received).toBe(expected) // Object.is equality
[chrome 138.0.7204.100 linux #0-0]
[chrome 138.0.7204.100 linux #0-0] Expected: ""
[chrome 138.0.7204.100 linux #0-0] Received: "Top content
[chrome 138.0.7204.100 linux #0-0] Bottom content"
[chrome 138.0.7204.100 linux #0-0]     at Context.<anonymous> (http://localhost:41807/home/runner/work/core/core/test/wdio/text-content-patch/cmp.test.tsx:34:41)
[chrome 138.0.7204.100 linux #0-0]
[chrome 138.0.7204.100 linux #0-0] 2) scoped encapsulation should not insert the text node if there is no default slot
[chrome 138.0.7204.100 linux #0-0] expect(received).toBe(expected) // Object.is equality

Expected: ""
Received: "New slot content"
[chrome 138.0.7204.100 linux #0-0] Error: expect(received).toBe(expected) // Object.is equality
[chrome 138.0.7204.100 linux #0-0]
[chrome 138.0.7204.100 linux #0-0] Expected: ""
[chrome 138.0.7204.100 linux #0-0] Received: "New slot content"
[chrome 138.0.7204.100 linux #0-0]     at Context.<anonymous> (http://localhost:41807/home/runner/work/core/core/test/wdio/text-content-patch/cmp.test.tsx:58:41)

John Jenkins added 4 commits July 18, 2025 09:43
# Conflicts:
#	src/hydrate/platform/hydrate-app.ts
#	src/runtime/initialize-component.ts
#	src/testing/platform/index.ts
#	src/utils/shadow-css.ts
#	test/wdio/ssr-hydration/cmp.test.tsx
@johnjenkins
Copy link
Copy Markdown
Contributor Author

@christian-bromann thanks - I've taken a different approach :)

@johnjenkins johnjenkins changed the title fix(runtime): do not apply other patches to non-slot components fix(runtime): stop applying patches to non-shadow / non-render() components Jul 18, 2025
@johnjenkins johnjenkins enabled auto-merge July 18, 2025 13:11
Copy link
Copy Markdown
Member

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@johnjenkins johnjenkins added this pull request to the merge queue Jul 18, 2025
@christian-bromann christian-bromann removed this pull request from the merge queue due to a manual request Jul 18, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jul 18, 2025
…onents (#6349)

* fix(runtime): do not apply other patches to non-slot components

* chore: use hasRenderFn

* chore: revert test revert :D

* chore: tidy

---------

Co-authored-by: John Jenkins <john.jenkins@nanoporetech.com>
Co-authored-by: Christian Bromann <git@bromann.dev>
@christian-bromann christian-bromann merged commit 3a18a37 into main Jul 18, 2025
69 checks passed
@christian-bromann christian-bromann deleted the dont-touch-non-slot-cmps branch July 18, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants