Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceInput + AutocompleteInput #6478

Closed
VSymonenko opened this issue Jul 30, 2021 · 1 comment
Closed

ReferenceInput + AutocompleteInput #6478

VSymonenko opened this issue Jul 30, 2021 · 1 comment

Comments

@VSymonenko
Copy link

What you were expecting:

Use ReferenceInput includes Autocompletenput. Documentation

What happened instead:

Has error when change value once or once again

Steps to reproduce:

  1. Go to page https://ig2c4.sse.codesandbox.io/#/comments/create
  2. Click on the input element
  3. Choose the first value "Fusce massa lorem, pulvinar a posuere ut, accumsan ac nisi"
  4. Click on any other element
  5. See an error: "Associated reference no longer appears to be available"

Related code:

import * as React from "react";

import {
  Create,
  SimpleForm,
  ReferenceInput,
  AutocompleteInput
} from "react-admin";

const CommentCreate = (props) => {
  return (
    <Create {...props}>
      <SimpleForm redirect={false}>
        <ReferenceInput reference="posts" source="post_id">
          <AutocompleteInput
            resettable
            optionText="title"
            // can't change value many times whith optionValue when user use keyboard
            // has an error when the value set once again
            optionValue="originId"
          />
        </ReferenceInput>
      </SimpleForm>
    </Create>
  );
};

export default CommentCreate;

codesandbox

Environment

  • React-admin version: 3.17.0
  • React version: ^17.0.0
  • Browser: Chrome Version 92.0.4515.107 (Official Build) (64-bit)
@djhi
Copy link
Collaborator

djhi commented Aug 30, 2021

Yes, although we support custom optionValue in all the selection inputs such as AutocompleteInput, it doesn't work within references which requires id. See #2022 (comment)

@djhi djhi closed this as completed Aug 30, 2021
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

No branches or pull requests

2 participants