fix(react): use circularDeepEqual in useEditorState to prevent stack overflow#7487
fix(react): use circularDeepEqual in useEditorState to prevent stack overflow#7487naaa760 wants to merge 1 commit intoueberdosis:mainfrom
Conversation
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 675abfe The changes in this PR will be included in the next version bump. This PR includes changesets to release 72 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
krehwell
left a comment
There was a problem hiding this comment.
we have add title support for link related too in this PR
but the useEditorState one is good on my end
There was a problem hiding this comment.
Pull request overview
This pull request addresses a critical stack overflow bug in @tiptap/react's useEditorState hook (issue #7482) by switching from deepEqual to circularDeepEqual to handle circular references in editor state. The PR also includes additional changes to the Link extension, adding support for the title attribute in markdown rendering.
Changes:
- Fixed stack overflow in
useEditorStateby usingcircularDeepEqualinstead ofdeepEqualfromfast-equals - Added
titleattribute support to Link extension for markdown serialization/deserialization - Added test coverage for links with and without title attributes in markdown conversion tests
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/useEditorState.ts | Changed default equality function from deepEqual to circularDeepEqual to prevent stack overflow with circular references |
| packages/extension-link/src/link.ts | Added title attribute to Link extension schema and updated markdown rendering to support title serialization |
| packages/markdown/tests/conversion-files/link-with-title.ts | New test file for link markdown conversion with title attribute |
| packages/markdown/tests/conversion-files/link-without-title.ts | New test file for link markdown conversion without title attribute |
| packages/markdown/tests/conversion-files/index.ts | Exported new link test modules |
| .changeset/link-title-markdown.md | Changeset for Link markdown rendering changes |
| .changeset/link-title-attribute.md | Changeset for Link title attribute addition |
| @@ -1,5 +1,5 @@ | |||
| import type { Editor } from '@tiptap/core' | |||
| import { deepEqual } from 'fast-equals' | |||
| import { circularDeepEqual } from 'fast-equals' | |||
There was a problem hiding this comment.
Missing changeset for the React fix. The PR description indicates this is a fix for issue #7482 (stack overflow in useEditorState), but there's no changeset file for the @tiptap/react package. According to the project guidelines, user-facing changes require a changeset.
There was a problem hiding this comment.
Can you extract your link changes into an extra PR please?
| target?: string | null | ||
| rel?: string | null | ||
| class?: string | null | ||
| title?: string | null |
There was a problem hiding this comment.
Discrepancy between PR description and changes. The PR title and description focus on fixing the stack overflow issue in useEditorState, but the PR also includes unrelated changes to the Link extension (adding title attribute support) and markdown test files. These Link extension changes should either be mentioned in the PR description or moved to a separate PR for better change tracking and review clarity.
Changes Overview
Implementation Approach
Testing Done
Verification Steps
Additional Notes
Checklist
[ ] Changeset if needed.
[ ] No library breakage.
fix: #7482