You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.
When pre-populating a saved value, ReferenceInput getDataStatus() will only enter the "waiting" state when matchingReferences is not set.
But on the second load of a ReferenceInput it can never enter waiting state because matchingReferences is now set.
On the second load, if the new value to be pre-populated is not already in matchingReferences then the field SHOULD enter the waiting state until it is fetched, but it will not enter the waiting state so it renders prematurely.
What you were expecting:
ReferenceInput+Autocomplete should always prepopulate with saved reference value and should be able to enter a waiting state even when some matchingReferences have been loaded if the input.value is not found in matchingReferences.
What happened instead:
Viewing a record with a saved value pre-populates correctly initially. Switching to another record of the same type will not pre-populate the value if the value is not coincidentally already in matchingReferences.
AutocompleteInput is particularly susceptible to this because often the loaded value will not already be present in matchingReferences.
Steps to reproduce:
Say we have a resource with a value controlled with ReferenceInput+AutocompleteInput.
Say there are two existing records:
Record 1 has value X
Record 2 has value Y
View Record 1 the value X pre-populates correctly into AutocompleteInput.
View Record 2 the value Y will not be found in matchingReferences so the field should enter the waiting state while the reference is fetched. Once fetched it should then pre-populate Y into AutocompleteInput.
However, when viewing Record 2 the value Y does not enter the waiting state, and does not pre-poulate and the dropdown shows the aor.input.references.single_missing error.
Environment
Admin-on-rest version: latest
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
When pre-populating a saved value, ReferenceInput getDataStatus() will only enter the "waiting" state when matchingReferences is not set.
But on the second load of a ReferenceInput it can never enter waiting state because matchingReferences is now set.
On the second load, if the new value to be pre-populated is not already in matchingReferences then the field SHOULD enter the waiting state until it is fetched, but it will not enter the waiting state so it renders prematurely.
Related code:
Existing code in ReferenceInput:getDataStatus()
Suggested alternative:
What you were expecting:
ReferenceInput+Autocomplete should always prepopulate with saved reference value and should be able to enter a waiting state even when some matchingReferences have been loaded if the input.value is not found in matchingReferences.
What happened instead:
Viewing a record with a saved value pre-populates correctly initially. Switching to another record of the same type will not pre-populate the value if the value is not coincidentally already in matchingReferences.
AutocompleteInput is particularly susceptible to this because often the loaded value will not already be present in matchingReferences.
Steps to reproduce:
Environment
The text was updated successfully, but these errors were encountered: