Skip to content

LHNOptionsList cleanup, hoist isWeb, deduplicate reportAttributes, remove duplicate guard #86648

@JS00001

Description

@JS00001

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

Issue OwnerCurrent Issue Owner: @BartekObudzinski

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions