File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed
test/e2e/app-dir/rsc-basic/app Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,7 @@ export const FlushEffectsContext = createContext<FlushEffectsHook | null>(
88
99export function useFlushEffects ( callbacks : ( ) => React . ReactNode ) : void {
1010 const flushEffectsImpl = useContext ( FlushEffectsContext )
11- if ( ! flushEffectsImpl ) {
12- throw new Error ( `useFlushEffects can not be called on the client.` )
13- }
11+ // Should have no effects on client where there's no flush effects provider
12+ if ( ! flushEffectsImpl ) return
1413 return flushEffectsImpl ( callbacks )
1514}
Original file line number Diff line number Diff line change @@ -30,13 +30,14 @@ export default function RootStyleRegistry({ children }) {
3030 )
3131 } )
3232
33- if ( typeof window !== 'undefined' ) {
34- return children
33+ // Only include style registry on server side for SSR
34+ if ( typeof window === 'undefined' ) {
35+ return (
36+ < StyleSheetManager sheet = { styledComponentsStyleSheet . instance } >
37+ < StyleRegistry registry = { jsxStyleRegistry } > { children } </ StyleRegistry >
38+ </ StyleSheetManager >
39+ )
3540 }
36- console . log ( 'render' )
37- return (
38- < StyleSheetManager sheet = { styledComponentsStyleSheet . instance } >
39- < StyleRegistry registry = { jsxStyleRegistry } > { children } </ StyleRegistry >
40- </ StyleSheetManager >
41- )
41+
42+ return children
4243}
You can’t perform that action at this time.
0 commit comments