We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
1.43.1
Using @playwright/experimental-ct-react17:
@playwright/experimental-ct-react17
const result = await mount(<Component />
await result.unmount()
await mount(<Component />
https://github.com/cgatl/react-ct-17-remount-bug
The second call to mount should mount the component
mount
An error is thrown
Compare window.playwrightUnmount for ct-react https://github.com/microsoft/playwright/blob/v1.43.1/packages/playwright-ct-react/registerSource.mjs#L84-L91, to the equivalent function for ct-react-17 https://github.com/microsoft/playwright/blob/v1.43.1/packages/playwright-ct-react17/registerSource.mjs. The latter is missing:
window.playwrightUnmount
ct-react
ct-react-17
entry.root.unmount(); __pwRootRegistry.delete(rootElement);
This is why we see "Attempting to mount a component into an container that already has a React root" the next time mount is called https://github.com/microsoft/playwright/blob/v1.43.1/packages/playwright-ct-react/registerSource.mjs#L55.
"Attempting to mount a component into an container that already has a React root"
Possibly the fix is as simple as updating window.playwrightUnmount to match ct-react. edit: not quite, see below
System: OS: macOS 13.6.6 CPU: (10) x64 Apple M1 Pro Memory: 159.00 MB / 32.00 GB Binaries: Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node Yarn: 1.22.21 - ~/.nvm/versions/node/v20.10.0/bin/yarn npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm pnpm: 8.14.0 - ~/.nvm/versions/node/v20.10.0/bin/pnpm IDEs: VSCode: 1.88.1 - /usr/local/bin/code Languages: Bash: 3.2.57 - /bin/bash npmPackages: @playwright/experimental-ct-react17: ^1.43.1 => 1.43.1
The text was updated successfully, but these errors were encountered:
this change (here) appears to fix the issue:
Sorry, something went wrong.
@cgatl Thank you for the issue, I can repro.
fix(ct): mount then unmount then mount (#30657)
9ce41fa
closes #30628
pavelfeldman
Successfully merging a pull request may close this issue.
Version
1.43.1
Steps to reproduce
Using
@playwright/experimental-ct-react17
:const result = await mount(<Component />
)await result.unmount()
await mount(<Component />
)https://github.com/cgatl/react-ct-17-remount-bug
Expected behavior
The second call to
mount
should mount the componentActual behavior
An error is thrown
Additional context
Compare
window.playwrightUnmount
forct-react
https://github.com/microsoft/playwright/blob/v1.43.1/packages/playwright-ct-react/registerSource.mjs#L84-L91, to the equivalent function forct-react-17
https://github.com/microsoft/playwright/blob/v1.43.1/packages/playwright-ct-react17/registerSource.mjs. The latter is missing:This is why we see
"Attempting to mount a component into an container that already has a React root"
the next time mount is called https://github.com/microsoft/playwright/blob/v1.43.1/packages/playwright-ct-react/registerSource.mjs#L55.Possibly the fix is as simple as updatingedit: not quite, see belowwindow.playwrightUnmount
to matchct-react
.Environment
The text was updated successfully, but these errors were encountered: