Skip to content

Commit

Permalink
fix: combobox rendered text when value prop changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzucchelli committed Oct 3, 2023
1 parent 79d7b72 commit 598164d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/strapi-design-system/src/Combobox/Combobox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ export const ComboboxInput = React.forwardRef<ComboboxInputElement, ComboboxInpu
skipWhen: !internalIsOpen,
});

React.useEffect(() => {
/**
* When the value prop changes "externally" update the text input value too
*/
handleTextValueChange(value || '');

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value]);

const hintId = `${generatedId}-hint`;
const errorId = `${generatedId}-error`;

Expand Down

0 comments on commit 598164d

Please sign in to comment.