Commit d611b94
authored
fix: disable GC on child collections created by includes system (#1430)
* test: add regression test for child collection GC data loss
Child collections created by the includes system (nested subqueries in
.select()) inherit the default gcTime of 5 minutes. When the only React
subscriber unmounts (e.g., virtual table scrolling), the collection gets
garbage collected and data is permanently lost.
This test subscribes to a child collection, unsubscribes (simulating
component unmount), advances past the GC timeout, and asserts the data
is still intact. It currently fails, proving the bug.
* fix: disable GC on child collections created by includes system
Add gcTime: 0 to createChildCollectionEntry so child collections are
not subject to time-based garbage collection.
Child collection lifecycle is already managed by flushIncludesState
Phase 5, which removes them from childRegistry when parent rows are
deleted. External GC is unnecessary and causes permanent data loss when
React subscribers unmount (e.g., virtual table scrolling, tab switching,
conditional rendering).
Fixes #14291 parent caf5166 commit d611b94
2 files changed
Lines changed: 51 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1515 | 1515 | | |
1516 | 1516 | | |
1517 | 1517 | | |
| 1518 | + | |
1518 | 1519 | | |
1519 | 1520 | | |
1520 | 1521 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
4012 | 4013 | | |
4013 | 4014 | | |
4014 | 4015 | | |
| 4016 | + | |
| 4017 | + | |
| 4018 | + | |
| 4019 | + | |
| 4020 | + | |
| 4021 | + | |
| 4022 | + | |
| 4023 | + | |
| 4024 | + | |
| 4025 | + | |
| 4026 | + | |
| 4027 | + | |
| 4028 | + | |
| 4029 | + | |
| 4030 | + | |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
| 4051 | + | |
| 4052 | + | |
| 4053 | + | |
| 4054 | + | |
| 4055 | + | |
| 4056 | + | |
| 4057 | + | |
| 4058 | + | |
| 4059 | + | |
| 4060 | + | |
| 4061 | + | |
| 4062 | + | |
| 4063 | + | |
4015 | 4064 | | |
0 commit comments