Skip to content

Commit 1201ff7

Browse files
committed
[DevTools] Don't call Hooks conditionally
1 parent dce1f6c commit 1201ff7

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTimeline.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,6 @@ function SuspenseTimelineInput() {
3939
const min = 0;
4040
const max = timeline.length > 0 ? timeline.length - 1 : 0;
4141

42-
if (rootID === null) {
43-
return (
44-
<div className={styles.SuspenseTimelineInput}>No root selected.</div>
45-
);
46-
}
47-
48-
if (!store.supportsTogglingSuspense(rootID)) {
49-
return (
50-
<div className={styles.SuspenseTimelineInput}>
51-
Can't step through Suspense in production apps.
52-
</div>
53-
);
54-
}
55-
56-
if (timeline.length === 0) {
57-
return (
58-
<div className={styles.SuspenseTimelineInput}>
59-
Root contains no Suspense nodes.
60-
</div>
61-
);
62-
}
63-
6442
function switchSuspenseNode(nextTimelineIndex: number) {
6543
const nextSelectedSuspenseID = timeline[nextTimelineIndex];
6644
highlightHostInstance(nextSelectedSuspenseID);
@@ -175,6 +153,28 @@ function SuspenseTimelineInput() {
175153
};
176154
}, [playing]);
177155

156+
if (rootID === null) {
157+
return (
158+
<div className={styles.SuspenseTimelineInput}>No root selected.</div>
159+
);
160+
}
161+
162+
if (!store.supportsTogglingSuspense(rootID)) {
163+
return (
164+
<div className={styles.SuspenseTimelineInput}>
165+
Can't step through Suspense in production apps.
166+
</div>
167+
);
168+
}
169+
170+
if (timeline.length === 0) {
171+
return (
172+
<div className={styles.SuspenseTimelineInput}>
173+
Root contains no Suspense nodes.
174+
</div>
175+
);
176+
}
177+
178178
return (
179179
<>
180180
<Button

0 commit comments

Comments
 (0)