Skip to content

Commit

Permalink
fix(🎨): fix race condition in SkiaDomView
Browse files Browse the repository at this point in the history
fixes #2814

The race condition would occur when prop update in the view would trigger a redraw request, then the DOM  would also emit a  redraw request itself would get canceled due to the pending redraw. That first redraw request however, is not using the updated DOM version.

We are rearchitecturing this part of the system at the moment, where such issues won't be possible anymore. However this should be good fix for now.
  • Loading branch information
wcandillon authored Dec 18, 2024
1 parent e77754c commit 10056ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/skia/src/views/SkiaDomView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ export class SkiaDomView extends React.Component<SkiaDomViewProps> {
assertSkiaViewApi();
SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize);
}
this.tick();
if (onSize !== prevProps.onSize || root !== prevProps.root) {
this.tick();
}
}

componentWillUnmount(): void {
Expand Down

0 comments on commit 10056ec

Please sign in to comment.