Skip to content

Commit

Permalink
Merge pull request #857 from statisticsnorway/MIMIR-1855-Dropdown-fei…
Browse files Browse the repository at this point in the history
…l-verdi-etter-valg

Ensure component cares for its own state with regards to chosen element
  • Loading branch information
Glenruben committed Sep 11, 2023
2 parents af3968f + 6f6d0ae commit 22f234a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@statisticsnorway/ssb-component-library",
"version": "2.0.92",
"version": "2.0.93",
"description": "Component library for SSB (Statistics Norway)",
"main": "lib/bundle.js",
"scripts": {
Expand Down
10 changes: 0 additions & 10 deletions src/components/Dropdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,9 @@ const Dropdown = ({ className, header, icon, items, onSelect, open, placeholder,
};

useEffect(() => {
const itemToSelect = items.find(it => it.id && it.id === selectedOption.id);
if (itemToSelect) {
selectItem(selectedOption);
}
filterAvailableOptions(items);
}, [items]);

useEffect(() => {
if (selectedItem) {
selectItem(selectedItem);
}
}, [selectedItem]);

const filterItems = event => {
filterOptions(event.target.value);
};
Expand Down

0 comments on commit 22f234a

Please sign in to comment.