[pull] master from microsoft:master#474
Merged
Merged
Conversation
…les (#36247) ## Previous Behavior `@fluentui/web-components` had no server-side rendering path. Components were defined and rendered only on the client, so SSR frameworks could not pre-render Fluent web components into HTML and hydrate them on load. The e2e tests ran against a custom harness that only covered client-side rendering. ## New Behavior `@fluentui/web-components` now supports SSR via Declarative Shadow DOM, built on `@microsoft/fast-element` and `@microsoft/fast-html`. Every component in the package ships a paired `define-async.ts` / `*.definition-async.ts` module so its template can render on the server and hydrate on the client. The build also emits two new asset types alongside the JS modules, one pair per component (42 of each), exposed through new package subpath exports: - `@fluentui/web-components/<component>/template.html`: declarative HTML template wrapped in `<f-template>`, consumed by `@microsoft/fast-html` to render Declarative Shadow DOM on the server. - `@fluentui/web-components/<component>/styles.css`: plain CSS extracted from the component's styles, importable as a raw stylesheet without pulling in the component's JS. Currently, the SSR templates and styles are generated at build time and placed in the `dist` output, but we may want to provide them as src assets in the future for easier consumption and customization. New test harness modules (`test/src/entry-client.ts`, `test/src/entry-server.ts`) and a `test/ssr.html` entry point template exercise the DSD output end-to-end. The e2e pipeline runs SSR tests after CSR tests. Several components needed template or base adjustments to render correctly under SSR: tooltip (anchor positioning polyfill handling), text-input, textarea, tree, and tree-item. The `theme/set-theme` tests are skipped under SSR. ## Next Steps This PR lays the groundwork for SSR support in `@fluentui/web-components`, but there are still some follow-up tasks to complete: - Update to the latest `@microsoft/fast-element` and remove the `@microsoft/fast-html` dependency, as DSD rendering will be directly supported in FAST in the next major release. - Provide more detailed documentation and examples for using the SSR templates and styles. - Add more comprehensive SSR tests covering edge cases and hydration scenarios.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )