← All notes

NOTES

Keeping a wheel selection aligned as options change

A small react-wheel-picker contribution for selection position after dynamic option updates.

#Open source#React#Bug fix

When the option list changes

A wheel picker can keep the same selected value while that value moves to a different position in a new option list. In react-wheel-picker, the selection could remain at its previous index. The public archive and merged PR #54 show the issue and the fix.

I changed one line in the dependency array of the useEffect that calls selectByValue(value). I added options to the existing value and valueProp dependencies, so changing the list also realigns the wheel to the selected value. That one line is the PR diff, merged on June 30, 2025.

PR mergedPublished
CONVERSATION

Comments

Open on GitHub ↗

Questions and ideas are welcome. Sign in with GitHub to comment; replies are public and shared between the Korean and English versions.