Why do I get "Associated reference no longer appears to be available"?

Viewed 2020

I have explained whole issue here https://github.com/marmelab/react-admin/issues/5142 . But as far as the stackoverflow community is more active, I mention the issue here too.

Please explain me, why this sample code is working properly

  <ReferenceInput label={"Specification"} perPage={20} source={"specificationName"}
                                    reference={ResourceNames.SPECIFICATIONS}>
                        <SelectInput optionText={"name"}/>
   </ReferenceInput>

while this code is showing the "Associated reference no longer appears to be available" error message.

  <ReferenceInput label={"Specification"} perPage={20} source={"specificationName"}
                                    reference={ResourceNames.SPECIFICATIONS}>
                        <SelectInput optionText={"name"} optionValue={"name"} />
   </ReferenceInput>

The only difference between above given examples - is the optionValue property passed to SelectInput. What's wrong with it? I don't want my SelectInput to use ID as a value... How the optionValue property is related to the above mentioned error message?

Please help! Thank you in advance

2 Answers

This error can occur also if your model filter doesn't accept an ids attribute, observed in the web console.

I ended up in this situation because I based my schema off the schema provided in the readme of ra-data-graphql-simple.

To solve, I added the ids property to the type filter in the graphql schema.

PS - if you're bootstrapping like I was, it will be time to swap out the Edit and List Guessers for components that make use of a reference field

Related