Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit d062708

Browse files
authored
fix(ssr): reset class counter to zero before each render (#1153)
Previously, the unique class generation routine used a local variable to keep track of individual elements. However, this counter would never get reset, meaning that it would get incremented on each subsequent server render, leading to enormous values for the class names, erroneously. This resets the counter to zero for each render.
1 parent dd36781 commit d062708

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/lib/server/server-provider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export function generateStaticFlexLayoutStyles(serverSheet: StylesheetMap,
4040
// Get the initial stylings for all of the directives,
4141
// and initialize the fallback block of stylings
4242
const defaultStyles = new Map(serverSheet.stylesheet);
43+
// Reset the class counter, otherwise class numbers will
44+
// increase with each server render
45+
nextId = 0;
4346
let styleText = generateCss(defaultStyles, 'all', classMap);
4447

4548
[...breakpoints].sort(sortAscendingPriority).forEach((bp, i) => {

0 commit comments

Comments
 (0)