chore: correct node integration docs to match published render() signature#296
Merged
Merged
Conversation
This was referenced May 16, 2026
…ature All three framework examples in docs/guide/integrations/node.md called `render(protocol, JSON.stringify(state), entry, requestPath, onChunk)` with positional arguments and a streaming callback. The published API in @microsoft/webui (per packages/webui/src/index.ts) is: render(protocol, state, options?): string renderStream(protocol, state, onChunk, options?): void `state` accepts an object directly (auto-stringified). `entry`, `requestPath`, and `plugin` are members of a RenderOptions object. `render` returns the rendered HTML; only `renderStream` uses a chunk callback. This PR: - Rewrites the Node.js example to use renderStream() (preserves the streaming flavor of the original). - Rewrites the Bun and Deno examples to use render() (simpler — they construct a Response from a string anyway). - Updates the API Reference table to show both render and renderStream with correct signatures, adds a RenderOptions table, and notes that state accepts an object or string. No code changes; docs-only.
732e5c0 to
7aab040
Compare
mohamedmansour
approved these changes
May 16, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Rewrite the three framework examples and the API Reference table in
docs/guide/integrations/node.mdto match the actual signature ofrender()/renderStream()exported from@microsoft/webui.Why
I'm integrating WebUI into a non-WebUI Node host, and the published Node integration page is the first thing a new adopter reads. The page currently teaches:
but
packages/webui/src/index.tsactually exports:Copying any of the three examples into a fresh project does not work, in three different ways:
entry,requestPath, andpluginare properties on aRenderOptionsobject, not positional args.stateaccepts an object directly, soJSON.stringifyis unnecessary boilerplate that suggests the API requires it.renderreturns the full HTML as a string; onlyrenderStreaminvokes a chunk callback. The Bun and Deno examples collect chunks into an array and.join('')them, which is doubly confusing because that's exactly whatrenderalready does internally.How I tested
packages/webui/src/index.tsis the source of truth for the exported signatures. The three rewritten examples match the exported types and use the correct entry point (renderStreamwhere streaming is desired,renderfor accumulate-then-respond).Notes
users/janechu/fix-node-integration-docsper my host repo's agent-driven branch convention. Happy to rename tojanechu/fix-node-integration-docsif you prefer.