Skip to content

Commit cef9a60

Browse files
committed
chore(ssr-runtime): add warning for old renderComponent signature
1 parent 7d63aa6 commit cef9a60

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/@lwc/ssr-runtime/src/render.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,32 @@ export class RenderContext {
208208
}
209209
}
210210

211+
/**
212+
* Create a string representing an LWC component for server-side rendering.
213+
* @param tagName The HTML tag name of the component
214+
* @param Component The `LightningElement` component constructor
215+
* @param props HTML attributes to provide for the root component
216+
* @param styleDedupe Provide a string key or `true` to enable style deduping via the `<lwc-style>`
217+
* helper. The key is used to avoid collisions of global IDs.
218+
* @param mode SSR render mode. Can be 'sync', 'async' or 'asyncYield'. Must match the render mode
219+
* used to compile your component.
220+
* @returns String representation of the component
221+
*/
211222
export async function serverSideRenderComponent(
212223
tagName: string,
213224
Component: ComponentWithGenerateMarkup,
214225
props: Properties = {},
215226
styleDedupe: string | boolean = false,
216227
mode: CompilationMode = DEFAULT_SSR_MODE
217228
): Promise<string> {
229+
// TODO [#5309]: Remove this warning after a single release
230+
if (process.env.NODE_ENV !== 'production') {
231+
if (arguments.length === 6 || !['sync', 'async', 'asyncYield'].includes(mode)) {
232+
throw new Error(
233+
"The signature for @lwc/ssr-runtime's `renderComponent` has changed. There is now only one parameter for style dedupe."
234+
);
235+
}
236+
}
218237
if (typeof tagName !== 'string') {
219238
throw new Error(`tagName must be a string, found: ${tagName}`);
220239
}

0 commit comments

Comments
 (0)