From 0c659810bc299d578e14e069044afd8a1cc77a97 Mon Sep 17 00:00:00 2001 From: Aleksandra Cynk Date: Tue, 23 Jul 2024 13:03:16 +0200 Subject: [PATCH 1/2] Fix require render --- .../RuntimeTests/ReJest/TestRunner/TestRunner.ts | 5 +++-- .../examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts | 10 ++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts b/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts index eeb5ea5bd49..0271b825e13 100644 --- a/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts +++ b/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts @@ -94,10 +94,11 @@ export class TestRunner { } public async render(component: ReactElement | null) { - if (!component && this._wasRenderedNull) { + if (!component && this._renderLock.wasRenderedNull()) { return; } - this._wasRenderedNull = !component; + + this._renderLock.setRenderedNull(!component); this._renderLock.lock(); try { diff --git a/apps/common-app/src/examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts b/apps/common-app/src/examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts index d8fac80feb7..ecc560bf605 100644 --- a/apps/common-app/src/examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts +++ b/apps/common-app/src/examples/RuntimeTests/ReJest/utils/SyncUIRunner.ts @@ -39,6 +39,8 @@ export class SyncUIRunner extends WaitForUnlock { } export class RenderLock extends WaitForUnlock { + private _wasRenderedNull: boolean = true; + public lock() { this._setLock(true); } @@ -47,6 +49,14 @@ export class RenderLock extends WaitForUnlock { this._setLock(false); } + public wasRenderedNull() { + return this._wasRenderedNull; + } + + public setRenderedNull(wasRenderedNull: boolean) { + this._wasRenderedNull = wasRenderedNull; + } + public async waitForUnlock(maxWaitTime?: number) { await this._waitForUnlock(maxWaitTime); } From bec72d2e53f3e27b9f9f8cf47ca5365de8f67c44 Mon Sep 17 00:00:00 2001 From: Aleksandra Cynk Date: Tue, 23 Jul 2024 13:06:42 +0200 Subject: [PATCH 2/2] Remove _wasRenderedNull --- .../src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts b/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts index 0271b825e13..4af04fa5f7e 100644 --- a/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts +++ b/apps/common-app/src/examples/RuntimeTests/ReJest/TestRunner/TestRunner.ts @@ -55,7 +55,6 @@ export class TestRunner { private _currentTestCase: TestCase | null = null; private _renderHook: (component: ReactElement | null) => void = () => {}; private _valueRegistry: Record = {}; - private _wasRenderedNull: boolean = false; private _includesOnly: boolean = false; private _syncUIRunner: SyncUIRunner = new SyncUIRunner(); private _renderLock: RenderLock = new RenderLock();