Skip to content

Commit

Permalink
Merge pull request #2432 from SpareBank1/develop_fix-initial-values
Browse files Browse the repository at this point in the history
fix(ffe-account-selector-react): search does not work with custom acc…
  • Loading branch information
pethel authored Dec 3, 2024
2 parents 4350002 + 4b84859 commit 2127fe9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,28 @@ export const PostListElement: Story = {
);
},
};

export const InitialValue: Story = {
args: {
...Standard.args,
},
render: function Render(args) {
const [selectedAccount, setSelectedAccount] = useState<Account>(
accounts[2],
);
return (
<InputGroup
label="Velg konto"
inputId={args.id}
labelId={args.labelledById}
onColoredBg={args.onColoredBg}
>
<AccountSelector
{...args}
selectedAccount={selectedAccount}
onAccountSelected={setSelectedAccount}
/>
</InputGroup>
);
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ export const AccountSelector = <T extends Account = Account>({
: undefined;

const onInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {
setInputValue(event.target.value);
if (allowCustomAccount) {
setInputValue(event.target.value);
}

if (inputProps?.onChange) {
inputProps.onChange(event);
}
Expand Down

0 comments on commit 2127fe9

Please sign in to comment.