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

Fixed a bug when WatchTextContent didnt work with a routed component #6463

Merged
merged 1 commit into from
Jan 26, 2024

Conversation

peterhudec
Copy link
Contributor

Description of change

The method to convert React vdom to text was not working when the vdom contained routed components. This PR fixes this by switching back to the original mechanism, but with a reliable way to make the children—which are rendered, but hidden—inaccessible to Cypress.

Also improved tests which also check that the component doesn't throw when unmounted and that it doesn't leak its children to Cypress.

Test instructions

  1. Use the component with one of the react-router components:
     <WatchTextContent onTextContentChange={console.log}>
       <Link to="foo">foo</Link>
     </WatchTextContent>
  2. There should be no error in the console (before this PR therew would be the "Invariant failed: You should not use <Link> outside a <Router>" error)

Checklist

  • Has the branch been rebased to main?
  • Automated tests (Any of the following when applicable: Unit, Functional or End-to-End)
  • Manual compatibility testing (Browsers: Chrome, Firefox, Edge, Safari)

@peterhudec peterhudec requested a review from a team as a code owner January 25, 2024 17:40
Copy link

cypress bot commented Jan 25, 2024

Passing run #50503 ↗︎

0 76 7 0 Flakiness 0

Details:

Fixed a bug when WatchTextContent didnt work with a routed component
Project: data-hub-frontend Commit: 600973fa22
Status: Passed Duration: 08:36 💡
Started: Jan 25, 2024 6:13 PM Ended: Jan 25, 2024 6:22 PM

Review all test suite changes for PR #6463 ↗︎

@peterhudec peterhudec merged commit 761dbe5 into main Jan 26, 2024
16 checks passed
@peterhudec peterhudec deleted the fix/watch-text-content branch January 26, 2024 12:01
chopkinsmade pushed a commit that referenced this pull request Jan 26, 2024
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.

3 participants