Skip to content

Expose select to async creatable#1360

Closed
DanielHeath wants to merge 4 commits intoJedWatson:masterfrom
DanielHeath:expose-select-to-async-creatable
Closed

Expose select to async creatable#1360
DanielHeath wants to merge 4 commits intoJedWatson:masterfrom
DanielHeath:expose-select-to-async-creatable

Conversation

@DanielHeath
Copy link
Contributor

Both Async and Creatable keep a reference to the underlying Select (which can be accessed by consumers), but AsyncCreatable does not.

This patch unifies this behavior.

This abstraction might be justified if there were 3+
copies of the loop, but for a single item it's
added overhead + confusion to no benefit.
Previously, if you provided an `onInputChange` prop to a
`Creatable` it would be silently discarded.

After this change you can use Creatable and also get an
event when the user types input.
When deleting a multi select item, the input is cleared
but no change event is fired for the input box.

This patch detects changes to the options list and
updates `Creatable`'s cache of the input value.
This enables users of AsyncCreatable to hook the Select which is
created and/or access it as a ref.

Previously there was no way to get at the underlying Select if
you used AsyncCreatable.
@DanielHeath DanielHeath force-pushed the expose-select-to-async-creatable branch from 2d3c063 to 1ddb8d9 Compare November 14, 2016 01:02
@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 92.494% when pulling 1ddb8d9 on DanielHeath:expose-select-to-async-creatable into ad337ee on JedWatson:master.

@gwyneplaine
Copy link
Collaborator

thanks for this @DanielHeath I've taken out the main chunk of this PR and ported it over to this one #2084

the other fixes you've made have already been resolved in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants