Skip to content

Handle default external id in SelectInput component (#1637) - #1691

Open
jochenklar wants to merge 8 commits into
2.5.2/releasefrom
2.5.2/fix/default-external-id
Open

Handle default external id in SelectInput component (#1637)#1691
jochenklar wants to merge 8 commits into
2.5.2/releasefrom
2.5.2/fix/default-external-id

Conversation

@jochenklar

Copy link
Copy Markdown
Member

This PR adds the handling of default external_ids in SelectInput component.

Resolves: #1637 .

@MyPyDavid MyPyDavid Jul 29, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have an issue with this search definition in a (collection) question with an Optionset Provider plugin and multiple stored values. When the page opens it will make a lot of GET requests with a search, but those are not needed because a value is already there. So could we change this to:

const search = searchText

only?

PS, some infos by Codex:

getValueOption() already creates a temporary option from the stored value.external_id and value.text, so an existing value can be displayed without loading it again. The new useEffect in this PR would still explicitly load defaults that have an external_id but no text. Typed user searches would continue to work normally.
value.text is the persisted display label returned by the provider when the value was selected. Its main purpose here appears to have been reconstructing the selected option, but getValueOption() already handles that case.

@jochenklar
jochenklar requested a review from MyPyDavid July 30, 2026 08:28
Comment thread rdmo/projects/assets/js/interview/components/main/widget/SelectInput.js Outdated
@MyPyDavid

Copy link
Copy Markdown
Member

It works, for example with the ROR Provider, when I set 05n911h24 as the Default external id but not when I set it to https://ror.org/05n911h24.
That seems a little counter-intuitive to me, but it is manageable by the editors. Only the relation between the "Default external id" and option set (the Provider) of the question may not seem so obvious.

@MyPyDavid

Copy link
Copy Markdown
Member

No, wait. Adding a value to a collection question seemingly replaces the first entry of the default value instead of adding another entry to the collection. 🙄

Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
Signed-off-by: David Wallace <david.wallace@tu-darmstadt.de>
@MyPyDavid

Copy link
Copy Markdown
Member

thanks for including part of the fixes!
Now, when I have the ROR provider in a collection question with a default, then it will add the default ROR-id every time when I add "+Entry" another entry.
For the rest it seems good to me!

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.

2 participants