Skip to content

Commit 2bd9765

Browse files
committed
Fix test readme
1 parent 2e34004 commit 2bd9765

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

tests/unit/README_RaceConditionTest.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1-
# SourceValue Race Condition Test Documentation
2-
3-
## Overview
1+
# Onyx sourceValue issues
42

53
These tests demonstrate and prove multiple issues with Onyx sourceValue handling:
64
1. **Race Condition**: Multiple discrete updates batched → only first `sourceValue` visible
75
2. **Logic Bug**: `useSidebarOrderedReports` conditional logic ignores available `sourceValues`
8-
3. **Compound Issue**: Both problems occurring simultaneously for maximum impact
6+
3. **Stale sourceValues**: `sourceValue` preserves the keys of the latest onyx update during unrelated rerenders
7+
8+
See the thread in [#quality](https://expensify.slack.com/archives/C05LX9D6E07/p1755792968968239?thread_ts=1755543034.080259&cid=C05LX9D6E07) for more info
99

1010
## Test Files
1111

1212
**`simpleSourceValueRaceConditionDemo.ts`** - Pure race condition test proving batching loses intermediate `sourceValues`
1313
**`useSidebarOrderedReportsVulnerability.ts`** - Logic bug and compound issue tests replicating production patterns
14+
**`staleSourceValueTest`** - Test demonstrating that sourceValue persists during unrelated renders, leading to unnecessary cache busing
1415

1516
## How to Run the Tests
1617

1718
```bash
1819
# Run the race condition test
1920
npm test -- tests/unit/simpleSourceValueRaceConditionDemo.ts
2021

21-
# Run the useSidebarOrderedReports vulnerability tests
22-
npm test -- tests/unit/useSidebarOrderedReportsVulnerability.ts
22+
# Run the useSidebarOrderedReports display bug tests
23+
npm test -- tests/unit/useSidebarOrderedReportsDisplayBug.ts
2324

24-
# Or run both test files
25-
npm test -- tests/unit/simpleSourceValueRaceConditionDemo.ts tests/unit/useSidebarOrderedReportsVulnerability.ts
25+
# Run the staleSourceValueTest tests
26+
npm test -- tests/unit/staleSourceValueTest.ts
2627

27-
# Run with verbose output to see detailed logging
28-
npm test -- tests/unit/simpleSourceValueRaceConditionDemo.ts --verbose
28+
# Or run all 3 at once
29+
npm test -- tests/unit/simpleSourceValueRaceConditionDemo.ts tests/unit/useSidebarOrderedReportsDisplayBug.ts tests/unit/staleSourceValueTest.ts
2930
```
3031

31-
## What the Test Proves
32+
# The race condition test and what it proves
3233

3334
### The Race Condition Mechanism
3435

0 commit comments

Comments
 (0)