Skip to content

Commit 0941e95

Browse files
Fix VirtualizedSectionList._setUpdateHighlightFor deleting from wrong target (memory leak)
## Summary Fix a typo in _setUpdateHighlightFor where the else branch (called on cell unmount to clean up) was calling: delete this._updateHighlightFor[cellKey]; This targeted this._updateHighlightFor ## Summary Fix a typo in _setUpdateHighlightFor where the else branch (called on cell unmount to clean up) was calling: delete this._updateHighlightFor[cellKey]; This targeted this._updateHighlightFor - the arrow function method itself - rather than this._updateHighlightMap, the backing store object. The FlowFixMe suppression comment was silencing the resulting Flow type error. Fix: delete this._updateHighlightMap[cellKey]; ## Impact - Memory leak: highlight callbacks accumulated in _updateHighlightMap and were never removed on unmount - - Stale callbacks: could trigger highlight state updates on cells that no longer exist - - The sibling method _setUpdatePropsFor always had the correct pattern ## Test Plan - Existing separator highlight tests cover this code path - - Typo fix restoring originally intended behavior ## Changelog [General] [Fixed] - Fix VirtualizedSectionList._setUpdateHighlightFor deleting from wrong target (memory leak) Differential Revision: D127652888 Pull Request resolved: #59455
1 parent f50b8b1 commit 0941e95

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎packages/virtualized-lists/Lists/VirtualizedSectionList.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,7 @@ class VirtualizedSectionList<
431431
if (updateHighlightFn != null) {
432432
this._updateHighlightMap[cellKey] = updateHighlightFn;
433433
} else {
434-
// $FlowFixMe[prop-missing]
435-
delete this._updateHighlightFor[cellKey];
434+
delete this._updateHighlightMap[cellKey];
436435
}
437436
};
438437

0 commit comments

Comments
 (0)