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 <thomas.roest@moxio.com>
  • Loading branch information
ThomasRoest and Thomas Roest committed 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
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.