From 102b97e66b1862fd0defcf285e191f874cf43a83 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Tue, 28 May 2024 16:11:21 +0200 Subject: [PATCH] fix: laggy report transitions --- src/libs/Navigation/NavigationRoot.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx index 06a3dce8d59a..77bd4b3000de 100644 --- a/src/libs/Navigation/NavigationRoot.tsx +++ b/src/libs/Navigation/NavigationRoot.tsx @@ -127,10 +127,10 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N } const activeWorkspaceID = getPolicyIDFromState(state as NavigationState); // Performance optimization to avoid context consumers to delay first render - setTimeout(() => { + requestAnimationFrame(() => { currentReportIDValue?.updateCurrentReportID(state); setActiveWorkspaceID(activeWorkspaceID); - }, 0); + }); parseAndLogRoute(state); // We want to clean saved scroll offsets for screens that aren't anymore in the state.