fix: guard tagName.toLowerCase() against undefined element#56
Open
tt-a1i wants to merge 1 commit intoaidenybai:mainfrom
Open
fix: guard tagName.toLowerCase() against undefined element#56tt-a1i wants to merge 1 commit intoaidenybai:mainfrom
tt-a1i wants to merge 1 commit intoaidenybai:mainfrom
Conversation
|
@tt-a1i is attempting to deploy a commit to the Million Team on Vercel. A member of the Team first needs to authorize it. |
During Next.js page transitions, elements may be destroyed and element.tagName can become undefined, causing TypeError. Fixes aidenybai#44
df22f0c to
aedc740
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
During Next.js page transitions, elements may be destroyed and
element.tagNamecan becomeundefined, causingTypeError: Cannot read properties of undefined (reading 'toLowerCase').This PR adds defensive checks to 4 places where
tagName.toLowerCase()was called without protection:context.ts:141-getHTMLPreviewfunctioncontext.ts:183-formatElementshelperagent.ts:180- element validation checkis-selection-inside-editable-element.ts:2-isEditableElementfunction (called fromselectionchangeevent)Changes
Related
Fixes #44