Skip to content

Commit

Permalink
fix: fix preview not visible after error
Browse files Browse the repository at this point in the history
fixes #2154
  • Loading branch information
Thomas Roest committed Jan 16, 2024
1 parent 6e00289 commit 1f435fc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/client/rsg-components/Preview/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ export default class Preview extends Component<PreviewProps, PreviewState> {
);

window.requestAnimationFrame(() => {
// this.unmountPreview();
if (!this.mountNode) {
return;

Check warning on line 98 in src/client/rsg-components/Preview/Preview.tsx

View check run for this annotation

Codecov / codecov/patch

src/client/rsg-components/Preview/Preview.tsx#L98

Added line #L98 was not covered by tests
}
try {
if (this.mountNode && this.reactRoot) {
if (this.reactRoot === null) {
this.reactRoot = createRoot(this.mountNode);
this.reactRoot.render(wrappedComponent);

Check warning on line 103 in src/client/rsg-components/Preview/Preview.tsx

View check run for this annotation

Codecov / codecov/patch

src/client/rsg-components/Preview/Preview.tsx#L102-L103

Added lines #L102 - L103 were not covered by tests
} else {
this.reactRoot.render(wrappedComponent);
}
} catch (err) {
Expand Down

0 comments on commit 1f435fc

Please sign in to comment.