From 905c9b2c28255fc04d3bdaeb05ad4309e55122b7 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Tue, 23 Apr 2024 09:30:53 +0100 Subject: [PATCH] Ensure that tracked changes are highlighted in read-only mode (#18036) GitOrigin-RevId: 5010e1649d8f15014f9c8ef578073be7c6545aa4 --- .../hooks/use-review-panel-state.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/services/web/frontend/js/features/ide-react/context/review-panel/hooks/use-review-panel-state.ts b/services/web/frontend/js/features/ide-react/context/review-panel/hooks/use-review-panel-state.ts index a0143e718d..6de9411847 100644 --- a/services/web/frontend/js/features/ide-react/context/review-panel/hooks/use-review-panel-state.ts +++ b/services/web/frontend/js/features/ide-react/context/review-panel/hooks/use-review-panel-state.ts @@ -428,17 +428,15 @@ function useReviewPanelState(): ReviewPanel.ReviewPanelState { let localResolvedThreadIds = resolvedThreadIds - if (!isRestrictedTokenMember) { - if (rangesTracker.comments.length > 0) { - const threadsLoadResult = await ensureThreadsAreLoaded() - if (threadsLoadResult?.resolvedThreadIds) { - localResolvedThreadIds = threadsLoadResult.resolvedThreadIds - } - } else if (loadingThreads) { - // ensure that tracked changes are highlighted even if no comments are loaded - setLoadingThreads(false) - dispatchReviewPanelEvent('loaded_threads') + if (!isRestrictedTokenMember && rangesTracker.comments.length > 0) { + const threadsLoadResult = await ensureThreadsAreLoaded() + if (threadsLoadResult?.resolvedThreadIds) { + localResolvedThreadIds = threadsLoadResult.resolvedThreadIds } + } else if (loadingThreads) { + // ensure that tracked changes are highlighted even if no comments are loaded + setLoadingThreads(false) + dispatchReviewPanelEvent('loaded_threads') } if (!loadingThreadsInProgressRef.current) {