Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit ce62244

Browse files
committed
fixed astronaut color
1 parent f19d185 commit ce62244

File tree

1 file changed

+13
-1
lines changed
  • src/_pages/LandingPage/components/HeaderView/components/Astronaut

1 file changed

+13
-1
lines changed

src/_pages/LandingPage/components/HeaderView/components/Astronaut/index.tsx

+13-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ const Astronaut: React.FC<Props> = (props) => {
2424
});
2525
const dark = useAgile(core.ui.ASTRONAUT_DARK);
2626

27+
const [mounted, setMounted] = useState(false);
28+
// The astronaut theme on SSR is always the default theme but the site theme
29+
// can be in a different mode. React hydration doesn't update DOM styles
30+
// that come from SSR. Hence force a re-render after mounting to apply the
31+
// current relevant styles. There will be a flash seen of the original
32+
// styles seen using this current approach but that's probably ok. Fixing
33+
// the flash will require changing the theming approach and is not worth it
34+
// at this point.
35+
useEffect(() => {
36+
setMounted(true);
37+
}, []);
38+
2739
useEffect(() => {
2840
if (!isRaised) return;
2941

@@ -50,7 +62,7 @@ const Astronaut: React.FC<Props> = (props) => {
5062
};
5163

5264
return (
53-
<div className={clsx(styles.Container, className)}>
65+
<div key={String(mounted)} className={clsx(styles.Container, className)}>
5466
<animated.div
5567
style={animated_Astronaut}
5668
className={styles.ImageContainer}>

0 commit comments

Comments
 (0)