Skip to content

feat: support optionValue in reference inputs#11270

Open
louzhedong wants to merge 1 commit into
marmelab:masterfrom
louzhedong:feat/reference-input-option-value
Open

feat: support optionValue in reference inputs#11270
louzhedong wants to merge 1 commit into
marmelab:masterfrom
louzhedong:feat/reference-input-option-value

Conversation

@louzhedong
Copy link
Copy Markdown

Adds optionValue support to ReferenceInputBase / useReferenceInputController so reference inputs can load the current record by an alternate key instead of always assuming id.

This keeps the default id behavior unchanged, but when optionValue is provided it:

  • fetches the current record with getList filtered by that field
  • keeps the current record in allChoices
  • avoids getMany for that lookup path

Verification:

  • node_modules\.bin\jest.cmd packages/ra-core/src/controller/input/useReferenceInputController.spec.tsx --runInBand
  • node_modules\.bin\jest.cmd packages/ra-core/src/controller/input/ReferenceInputBase.spec.tsx --runInBand
  • node_modules\.bin\tsc.cmd --noEmit -p packages/ra-core/tsconfig.json

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.

1 participant