Skip to content

Commit 4edb1ae

Browse files
committed
update comments
1 parent 430ac9f commit 4edb1ae

2 files changed

Lines changed: 1 addition & 8 deletions

File tree

src/hooks/useSearchHighlightAndScroll.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,7 @@ function useSearchHighlightAndScroll({
238238
}
239239
setNewSearchResultKeys(newKeys);
240240

241-
// Clear consumed manual highlight flags synchronously so subsequent detect runs
242-
// don't re-highlight the same IDs. A previous timer-based reset effect lost a race
243-
// with the reset of `newSearchResultKeys` (its cleanup kept canceling the timer
244-
// before it could fire), leaving flags stuck at `true` and causing every later add
245-
// to re-animate every prior expense.
241+
// Clear consumed manual highlight flags so subsequent detect runs don't re-highlight the same IDs.
246242
if (consumedManualIDs.length > 0) {
247243
mergeTransactionIdsHighlightOnSearchRoute(queryJSON.type, Object.fromEntries(consumedManualIDs.map((id) => [id, false])));
248244
}

tests/unit/useSearchHighlightAndScrollTest.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,6 @@ describe('useSearchHighlightAndScroll', () => {
332332
expect(result.current.newSearchResultKeys?.size).toBe(1);
333333
expect([...(result.current.newSearchResultKeys ?? new Set())]).toContain('transactions_3');
334334

335-
// The hook now clears the consumed manual highlight flag synchronously inside the
336-
// detect effect (right after `setNewSearchResultKeys`), instead of via a timer.
337-
// No need to wait — the merge has already fired by the time `rerender` returns.
338335
expect(spyOnMergeTransactionIdsHighlightOnSearchRoute).toHaveBeenCalledWith(baseProps.queryJSON.type, {'3': false});
339336
});
340337

0 commit comments

Comments
 (0)