Skip to content

Commit 85414bc

Browse files
committed
fix(atlas): guard BootSequence against stale closure / empty lines
- Capture BOOT_LINES[i] in a local before the setLines callback to avoid reading it after i has been incremented by the next scheduled tick - Render empty/undefined lines as nbsp instead of calling .startsWith
1 parent f61039f commit 85414bc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/pages/project-pages/AtlasProjectPage.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ const BootSequence = () => {
243243
const tick = () => {
244244
if (cancelled) return;
245245
if (i < BOOT_LINES.length) {
246-
setLines((prev) => [...prev, BOOT_LINES[i]]);
246+
const value = BOOT_LINES[i];
247+
setLines((prev) => [...prev, value]);
247248
i += 1;
248249
setTimeout(tick, 140);
249250
}
@@ -262,7 +263,9 @@ const BootSequence = () => {
262263
>
263264
{lines.map((line, i) => (
264265
<span key={i} className="block">
265-
{line.startsWith('[OK]') ? (
266+
{!line ? (
267+
<>&nbsp;</>
268+
) : line.startsWith('[OK]') ? (
266269
<>
267270
<span style={{ color: SAGE }}>{'[OK]'}</span>
268271
{line.slice(4)}

0 commit comments

Comments
 (0)