Comments (2)
Looks like the tag keeps emitted while resolving suspense boundaries and the new styles are inserted later.
You could change the code in style register to only flushing the styles once.
// src/lib/registry.tsx
const flushRef = useRef(false);
useServerInsertedHTML(() => {
const styles = styledComponentsStyleSheet.getStyleElement();
// Flush initial styles
if (!flushRef.current) {
flushRef.current = true;
return <>{styles}</>;
}
return null;
})
I tested a bit comparing to styled-components 6.0.x, it seems like a behavior change that we don't need to insert extra styles anymore and styled-components could manage the incoming styles itself.
from next.js.
Thanks for the response @huozhi. Unfortunately this solution doesn't work entirely for more complex use cases, as you get a flash of unstyled content before the suspense boundaries resolve.
from next.js.
Related Issues (20)
- Unable to connect to localhost the npm run dev is creashing | Thing is react js website is running fine but getting issue with nextjs only HOT 5
- Unnecessary styles for multi tenant style app
- renderToString is not available in the Instrumentation hook HOT 4
- Bug with unmatched Routes HOT 5
- Docs: server actions and mutations pending states HOT 1
- Constants from use client files not outputting correctly inside template string
- Nextjs cannot be built in Podman. HOT 1
- null is not an object (evaluating 't.parallelRoutes.get') HOT 3
- nextjs.org/learn chapter 15 code error HOT 1
- Suspense not working in a nested route
- OpenTelemetry Tracing is poluted with some extra spans from middlewares
- middleware: Return or Link to the home page, the index.json of the updated data is redirected HOT 1
- `unstable_cache` with certain value of revalidation interval persisted correctly in production build
- Failed To Load SWC binary for win32/x64 HOT 1
- Click the browser forward and back, and getServerSideProps does not re-execute HOT 20
- next.config.ts does not support top-level-await
- Failed to load SWC binary for win32/x64
- Custom cache handler with dynamic route + static params always shows 404 page HOT 2
- create-next-app (canary): Import of *.module.scss in Client Component causes `__webpack_require__.n is not a function` crash HOT 3
- Catch-all route also catches static assets
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next.js.