aor-dependent-input
aor-dependent-input copied to clipboard
Delayed updates on multiple DependentInput depending on SelectInput
The DependentInput has weird behaviour with defaultValue and SelectInput example below
when you click on the select it does not change value until you click on the same item again if you remove defaultValue's or if you have only one DependentInput it works ok
<SimpleForm>
<SelectInput source="type" choices={[
{
id: 'pc',
name: 'pc',
},
{
id: 'server',
name: 'server',
},
{
id: 'gateway',
name: 'gateway',
},
{
id: 'acnetel',
name: 'acnetel',
},
]} defaultValue="gateway" />
<DependentInput resolve={switchType('gateway')}>
<TextInput source="nat" defaultValue="gateway" />
</DependentInput>
<DependentInput resolve={switchType('pc')}>
<TextInput source="not" defaultValue="pc" />
</DependentInput>
<DependentInput resolve={switchType('server')}>
<TextInput source="nit" defaultValue="server" />
</DependentInput>
<DependentInput resolve={switchType('acnetel')}>
<TextInput source="net" defaultValue="acntel" />
</DependentInput>
</SimpleForm>
const switchType = (value) => (values) => {
return values['type'] === value;
};
I have exactly the same issue. Any solutions?
update to new RA where there is not DependentInput
before updating to RA i used modified DependentInput component: gist