Previously if a value argument was set before content had been set (which may happen during initialization) then a selection value would be set matching the value. This selection would probably be wrong, especially if optionValuePath is also present, meaning selection is expected to be an object.
This refactors some of the current implementation to make clearer what the code intent is, and makes these changes:
Rename setDefaultSelection to updateSelectionFromContent, and include logic that skips the work during initialization and propagated the value -> selection if needed.
Move updateSelectionFromContent into init instead of didInsertElement. This work just needs to happen after arguments, not after rendering itself.
Add tests that show value -> selection and selection -> value being honored when the content property changes.
Previously if a value argument was set before content had been set (which may happen during initialization) then a selection value would be set matching the value. This selection would probably be wrong, especially if
optionValuePath
is also present, meaning selection is expected to be an object.This refactors some of the current implementation to make clearer what the code intent is, and makes these changes:
init
instead ofdidInsertElement
. This work just needs to happen after arguments, not after rendering itself.