Skip to content

Commit

Permalink
Merge pull request #1 from wanglihuaya/fix-react-ssr-effect-waring-sd
Browse files Browse the repository at this point in the history
fix: lazy-route window undefined
  • Loading branch information
liuhui1999 committed Apr 12, 2024
2 parents 6f3d81b + 989db86 commit 0dd7487
Showing 1 changed file with 3 additions and 1 deletion.
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 0dd7487

Please sign in to comment.