From 10056ecfec1aba942c20981a1a4a1185975c2818 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 18 Dec 2024 14:29:16 +0100 Subject: [PATCH] =?UTF-8?q?fix(=F0=9F=8E=A8):=20fix=20race=20condition=20i?= =?UTF-8?q?n=20SkiaDomView?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- packages/skia/src/views/SkiaDomView.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/skia/src/views/SkiaDomView.tsx b/packages/skia/src/views/SkiaDomView.tsx index baad65a810..26b4d1f5e2 100644 --- a/packages/skia/src/views/SkiaDomView.tsx +++ b/packages/skia/src/views/SkiaDomView.tsx @@ -52,7 +52,9 @@ export class SkiaDomView extends React.Component { assertSkiaViewApi(); SkiaViewApi.setJsiProperty(this._nativeId, "onSize", onSize); } - this.tick(); + if (onSize !== prevProps.onSize || root !== prevProps.root) { + this.tick(); + } } componentWillUnmount(): void {