Skip to content

Commit

Permalink
Fix preview error handling (#2158)
Browse files Browse the repository at this point in the history
fix: fix preview not visible after error

fixes #2154

---------

Co-authored-by: Thomas Roest <[email protected]>
  • Loading branch information
ThomasRoest and Thomas Roest authored Jan 19, 2024
1 parent 0802ffb commit 540f00e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/client/rsg-components/Preview/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,16 @@ export default class Preview extends Component<PreviewProps, PreviewState> {
/>
);

/* istanbul ignore next */
window.requestAnimationFrame(() => {
// this.unmountPreview();
if (!this.mountNode) {
return;
}
try {
if (this.mountNode && this.reactRoot) {
if (this.reactRoot === null) {
this.reactRoot = createRoot(this.mountNode);
this.reactRoot.render(wrappedComponent);
} else {
this.reactRoot.render(wrappedComponent);
}
} catch (err) {
Expand Down

0 comments on commit 540f00e

Please sign in to comment.