-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Explanation of Change
Three small dead-code and code-quality cleanups in LHNOptionsList.tsx with no behavior change:
Hoist getPlatform()/isWeb to module level. getPlatform() returns a stable constant — the platform never changes at runtime. Calling it inside the component body on every render, then listing isWeb in useCallback dep arrays, is unnecessary churn. Moving both to module scope removes them from two dep arrays (onScroll, onLayout) without changing behavior.
Remove dead !report null check and deduplicate reportAttributes lookup. The data.find() callback receives items directly from the data array, so report is always truthy at that point — the guard was unreachable. The same reportAttributes?.[report.reportID] lookup was also written twice in the same callback; it is now read once into attrs and reused.
Remove duplicate !flashListRef.current guard. The useEffect that scrolls to the top on option mode change already checks !flashListRef.current in the leading condition on line 225. The second identical guard four lines later was dead code.
PR: #86647