Skip to content

chore: upgrade deps#460

Merged
irahopkinson merged 1 commit intomainfrom
deps
Mar 11, 2026
Merged

chore: upgrade deps#460
irahopkinson merged 1 commit intomainfrom
deps

Conversation

@irahopkinson
Copy link
Copy Markdown
Collaborator

@irahopkinson irahopkinson commented Mar 11, 2026

  • update Lexical v0.41.0
  • tighten workspace overrides
  • fix linting after upgraded eslint-plugin-react-hooks
  • fix API extraction

Open with Devin

This change is Reviewable

@codesandbox
Copy link
Copy Markdown

codesandbox bot commented Mar 11, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 7 additional findings in Devin Review.

Open in Devin Review

Comment on lines 816 to +829
if (elem !== null) {
elem.classList.add("selected");
changedElems.push(elem);
setShowComments(true);
showCommentsTimeoutId = window.setTimeout(() => {
setShowComments(true);
}, 0);
}
}
}
}

return () => {
if (showCommentsTimeoutId !== undefined) {
window.clearTimeout(showCommentsTimeoutId);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Timeout IDs leak in loop — only last timeout is cleared on cleanup

When multiple active IDs and keys exist, showCommentsTimeoutId is overwritten on each loop iteration at packages/platform/src/marginal/comments/CommentPlugin.tsx:819. The cleanup at line 828 only clears the last timeout ID stored; all previously-created timeouts leak and will fire after the effect's cleanup runs. This can cause setShowComments(true) to execute after the effect has been torn down (e.g., when activeIDs changes rapidly or the component unmounts), leading to stale state updates.

Example: 3 matching elements → 2 leaked timeouts

If the nested loops find 3 elements, 3 setTimeout calls are made, but only the 3rd ID is saved. The cleanup clears timeout #3 but timeouts #1 and #2 still fire.

(Refers to lines 809-829)

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 however the CommentPlugin is deprecated and no longer used. Updates were only made to satisfy the new react-hooks/refs rule.

const seconds = Math.round(
(comment.timeStamp - (performance.timeOrigin + performance.now())) / 1000,
);
const [currentTimeMs, setCurrentTimeMs] = useState<number>(0);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Initial currentTimeMs of 0 causes all comments to flash "Just now" on first render

currentTimeMs is initialized to 0 at packages/platform/src/marginal/comments/CommentPlugin.tsx:460. Before the useEffect on line 462 fires (after the first paint), the render computes seconds = Math.round((comment.timeStamp - 0) / 1000) at line 475. Since comment.timeStamp is a large positive number (epoch-relative ms), seconds is a huge positive value, making seconds > -10 always true, so every comment displays "Just now" on the initial render regardless of its actual age. The effect corrects this after the first paint, but users see a brief flash of incorrect timestamps.

Suggested change
const [currentTimeMs, setCurrentTimeMs] = useState<number>(0);
const [currentTimeMs, setCurrentTimeMs] = useState<number>(
() => performance.timeOrigin + performance.now(),
);
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 however the CommentPlugin is deprecated and no longer used. Updates were only made to satisfy the new react-hooks/refs rule.

- update Lexical v0.41.0
- tighten workspace overrides
- fix linting after upgraded `eslint-plugin-react-hooks`
- fix API extraction
Copy link
Copy Markdown
Collaborator Author

@irahopkinson irahopkinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@irahopkinson made 2 comments.
Reviewable status: 0 of 25 files reviewed, 2 unresolved discussions (waiting on devin-ai-integration[bot]).

const seconds = Math.round(
(comment.timeStamp - (performance.timeOrigin + performance.now())) / 1000,
);
const [currentTimeMs, setCurrentTimeMs] = useState<number>(0);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 however the CommentPlugin is deprecated and no longer used. Updates were only made to satisfy the new react-hooks/refs rule.

Comment on lines 816 to +829
if (elem !== null) {
elem.classList.add("selected");
changedElems.push(elem);
setShowComments(true);
showCommentsTimeoutId = window.setTimeout(() => {
setShowComments(true);
}, 0);
}
}
}
}

return () => {
if (showCommentsTimeoutId !== undefined) {
window.clearTimeout(showCommentsTimeoutId);
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 however the CommentPlugin is deprecated and no longer used. Updates were only made to satisfy the new react-hooks/refs rule.

Copy link
Copy Markdown
Contributor

@tjcouch-sil tjcouch-sil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: thanks for all the hard work! BTW reviewing json files in this repo is really annoying in Reviewable because it says they have a custom diff specified in gitattributes. Do you know what that's about? Not some big deal.

@tjcouch-sil reviewed 25 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on devin-ai-integration[bot]).

@irahopkinson irahopkinson enabled auto-merge (squash) March 11, 2026 21:06
Copy link
Copy Markdown
Collaborator Author

@irahopkinson irahopkinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@irahopkinson resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved.

@irahopkinson irahopkinson merged commit 7316c28 into main Mar 11, 2026
7 checks passed
@irahopkinson irahopkinson deleted the deps branch March 11, 2026 21:14
Copy link
Copy Markdown
Collaborator Author

@irahopkinson irahopkinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a PR to improve gitattributes.

@irahopkinson made 1 comment.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants