Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Check table element before pasting it as a string #977

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

gnapse
Copy link
Contributor

@gnapse gnapse commented Dec 10, 2024

Overview

We're getting this error in Sentry, pointed to this library.

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))

The stack trace points to the line that calls Array.from(tableElement.rows).

PR Checklist

  • Pull request title follows the Conventional Commits Specification
  • Added/updated unit test cases and/or end-to-end test cases
  • Added/updated documentation to Storybook or README.md

Test plan

We do not know how to reproduce this. But hopefully the changes make sense.

Part of the key to accept these changes is the removal of the type coercion on the return value of parseHtmlToElement. It is safer to not do that, and then check that the returned element is an instance of HTMLTableElement. On top of that, as an extra check, I added the condition to check that tableElement.rows is not a falsy value.

@gnapse gnapse added the 🙋 Ask PR Used for PRs that need a review before merging. label Dec 10, 2024
@gnapse gnapse requested a review from rfgamaral December 10, 2024 21:10
@gnapse gnapse self-assigned this Dec 10, 2024
Copy link

netlify bot commented Dec 10, 2024

Deploy Preview for doist-typist ready!

Name Link
🔨 Latest commit 0c88719
🔍 Latest deploy log https://app.netlify.com/sites/doist-typist/deploys/67598d1cbc14d200095fb0b1
😎 Deploy Preview https://deploy-preview-977--doist-typist.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@rfgamaral rfgamaral left a comment

Choose a reason for hiding this comment

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

Looks good to me 🚀

@gnapse
Copy link
Contributor Author

gnapse commented Dec 11, 2024

@rfgamaral what's the process to create a new release? Will it work by just merging this PR?

@rfgamaral rfgamaral changed the title fix: check table element before pasting it as a string fix: Check table element before pasting it as a string Dec 11, 2024
@rfgamaral
Copy link
Member

Will it work by just merging this PR?

@gnapse Yes 😊

@rfgamaral rfgamaral force-pushed the ernesto/check-table-element-1 branch from 4825e4f to 0c88719 Compare December 11, 2024 13:01
@gnapse gnapse merged commit 954568e into main Dec 11, 2024
9 checks passed
@gnapse gnapse deleted the ernesto/check-table-element-1 branch December 11, 2024 14:15
doistbot added a commit that referenced this pull request Dec 11, 2024
## [7.0.4](v7.0.3...v7.0.4) (2024-12-11)

### Bug Fixes

* Check table element before pasting it as a string ([#977](#977)) ([954568e](954568e))
@doistbot
Copy link
Member

🎉 This PR is included in version 7.0.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@doistbot doistbot added the released Pull requests that have been released to production label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙋 Ask PR Used for PRs that need a review before merging. released Pull requests that have been released to production
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants