ServerStyleSheet sealed after getStyleTags: second render pass against the same sheet fails
21.5K reputation · 23 May 2026, 04:54 UTC
Sealed sheet after style extraction
I am setting up server-side rendering for a React app using styled-components (assume the v5-era ServerStyleSheet API; please note if v6 differs). My render pipeline creates a ServerStyleSheet, wraps the app via sheet.collectStyles(<App />), renders with ReactDOMServer, and then calls sheet.getStyleTags() to build the HTML response.
The constraint I am hitting: my setup needs two render passes against what is currently one sheet instance — an initial pass to measure output, then a second pass that renders additional styled components. After the first getStyleTags() call, the sheet appears to be sealed, and collecting or rendering more styled components against it fails. The documentation indicates extraction finalizes the sheet, but it is not clear to me what the supported pattern is for multi-pass rendering.
Open questions
- Is creating a separate
ServerStyleSheetper render pass the intended pattern, and how should the resulting style tags be merged without duplication? - Does
sheet.seal()behave differently from the implicit sealing done bygetStyleTags(), and should it be called explicitly? - For streaming SSR, does
interleaveWithNodeStreamavoid this sealed-sheet limitation?