react-spectrum
0a78fa2e - fix: avoid an extra render on mount in useDescription (#10754)

Commit
10 days ago
fix: avoid an extra render on mount in useDescription (#10754) * fix: avoid an extra render on mount in useDescription useDescription kept the description element's id in state that always started as undefined and was set in a layout effect, even when the shared node for that description already existed. Every component using it (each draggable via useDrag, tags, table column resizing, ...) rendered twice on mount, the second time synchronously from the layout phase. In a virtualized list of draggable rows this queued a synchronous update for every row scrolled into view. Initialize the state from the existing node so the effect sets the same id and React skips the update. Only the component that creates the node still re-renders. Ref counting, cleanup and description changes are unchanged. Assisted-by: ClaudeCode:claude-opus-5-5 * chore: remove comments from useDescription fix
Author
Parents
Loading