Skip to content

feat(hydrate): add serializeShadowroot to hydrateDocument #6259

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

Conversation

Armand-Lluka
Copy link
Contributor

@Armand-Lluka Armand-Lluka commented May 21, 2025

What is the current behavior?

GitHub Issue Number: #6240

What is the new behavior?

hydrateDocument has been extended to provide the serializeShadowRoot opt to be inline with what is provided with renderToString

Documentation

Does this introduce a breaking change?

  • Yes
  • No

Testing

Test was added to test.e2e.ts to verify the new option

Other information

@Armand-Lluka Armand-Lluka force-pushed the feat/add-serialize-shadow-root-hydrate-document branch 2 times, most recently from e00c071 to eda4107 Compare May 21, 2025 07:50
@Armand-Lluka Armand-Lluka marked this pull request as ready for review May 21, 2025 07:53
@Armand-Lluka Armand-Lluka requested a review from a team as a code owner May 21, 2025 07:53
@Armand-Lluka Armand-Lluka force-pushed the feat/add-serialize-shadow-root-hydrate-document branch 3 times, most recently from f022830 to db595bc Compare May 21, 2025 07:59
@Armand-Lluka Armand-Lluka changed the title Feat/add serialize shadow root hydrate document add serializeShadowroot to hydrateDocument May 21, 2025
@Armand-Lluka Armand-Lluka changed the title add serializeShadowroot to hydrateDocument feat(hydrate): add serializeShadowroot to hydrateDocument May 21, 2025
Copy link
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.

🙌 Awesome, thanks!

@christian-bromann
Copy link
Member

@Armand-Lluka it seems like the e2e tests are failing:

Summary of all failing tests
FAIL src/declarative-shadow-dom/test.e2e.ts
  ● renderToString › hydrateDocument › can hydrate components with open shadow dom by default

    expect(received).toContain(expected) // indexOf

    Matcher error: received value must not be null nor undefined

    Received has value: null

      386 |         fullDocument: false,
      387 |       });
    > 388 |       expect(html).toContain('s-id="');
          |                    ^
      389 |       expect(html).toContain('shadowrootmode="open"');
      390 |     });
      391 |

      at Object.<anonymous> (src/declarative-shadow-dom/test.e2e.ts:388:20)

  ● renderToString › hydrateDocument › can hydrate components with scoped shadow dom

    expect(received).toContain(expected) // indexOf

    Matcher error: received value must not be null nor undefined

    Received has value: null

      395 |         fullDocument: false,
      396 |       });
    > 397 |       expect(html).toContain('s-id="');
          |                    ^
      398 |       expect(html).not.toContain('shadowrootmode="open"');
      399 |     });
      400 |   });

      at Object.<anonymous> (src/declarative-shadow-dom/test.e2e.[26:38.6]  screenshot, tests finished, passed: false in 16.88 s MEM: 2634.9MB
[26:38.6]  screenshot, completeTimespan started ... MEM: 2634.9MB
ts:397:20)

@Armand-Lluka Armand-Lluka force-pushed the feat/add-serialize-shadow-root-hydrate-document branch 5 times, most recently from d64cdca to 09327e0 Compare May 22, 2025 17:12
@Armand-Lluka
Copy link
Contributor Author

Looks like I was running the wrong test suite 🙈

I've updated the type in stencil-public-compiler.ts, let me know if anything else needs updating.

@christian-bromann

@Armand-Lluka Armand-Lluka force-pushed the feat/add-serialize-shadow-root-hydrate-document branch from 09327e0 to a9a89eb Compare May 22, 2025 23:17
Copy link
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.

Last request: can we remove serializeShadowRoot from SerializeDocumentOptions since it extends HydrateDocumentOptions where it is now being defined.

Copy link
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 👍

@christian-bromann christian-bromann merged commit 47f8845 into stenciljs:main May 23, 2025
72 checks passed
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