Skip to content

Commit

Permalink
Merge pull request #284 from liuhui1999/fix-react-ssr-effect-waring
Browse files Browse the repository at this point in the history
Fix react ssr effect waring
  • Loading branch information
nksaraf committed May 21, 2024
2 parents 6f3d81b + 35259d3 commit d49a147
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/kind-fishes-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@vinxi/react": patch
"vinxi": patch
---

Fix react ssr effect waring
4 changes: 3 additions & 1 deletion packages/vinxi-react/lazy-route.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ export default function lazyRoute(
}

const Comp = forwardRef((props, ref) => {
useLayoutEffect(() => {
if (typeof window !== "undefined") {
useLayoutEffect(() => {
return () => {
// remove style tags added by vite when a CSS file is imported
cleanupStyles(styles);
};
}, []);
}
return createElement(
Fragment,
null,
Expand Down

0 comments on commit d49a147

Please sign in to comment.