Skip to content

Commit 746eac9

Browse files
committed
🧹
1 parent 8d2c0a5 commit 746eac9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

site/src/components/IconField/IconField.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,21 @@ export const IconField: FC<IconFieldProps> = ({
113113
)}
114114
</Popover>
115115

116-
{/* This component takes a long time to load (easily several seconds), so we
116+
{/*
117+
- This component takes a long time to load (easily several seconds), so we
117118
don't want to wait until the user actually clicks the button to start loading.
118119
Unfortunately, React doesn't provide an API to start warming a lazy component,
119120
so we just have to sneak it into the DOM, which is kind of annoying, but means
120-
that users shouldn't ever spend time waiting for it to load. */}
121-
<div css={{ ...visuallyHidden }}>
122-
{/* `ErrorBoundary` is for tests, this component requires `IntersectionObserver` */}
123-
<ErrorBoundary fallback={null}>
121+
that users shouldn't ever spend time waiting for it to load.
122+
- Except we don't do it when running tests, because Jest doesn't define
123+
`IntersectionObserver`, and it would make them slower anyway. */}
124+
{process.env.NODE_ENV !== "test" && (
125+
<div css={{ ...visuallyHidden }}>
124126
<Suspense>
125127
<EmojiPicker onEmojiSelect={() => {}} />
126128
</Suspense>
127-
</ErrorBoundary>
128-
</div>
129+
</div>
130+
)}
129131
</Stack>
130132
);
131133
};

0 commit comments

Comments
 (0)