Skip to content

Commit

Permalink
Add workaround to support favorite namespace when loading the app
Browse files Browse the repository at this point in the history
  • Loading branch information
jerolimov committed Dec 4, 2020
1 parent 0b11f56 commit b05cbe0
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion frontend/public/components/utils/dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,26 @@ export const Dropdown = (props) => {
[setBookmarks],
);

// FIXME: Remove this after latest namespace wasn't fetched from localStorage anymore.
const onFavorite = React.useCallback(
(key) => {
setFavoriteKey(key);
if (key) {
localStorage.setItem(favoriteStorageKey, key);
} else {
localStorage.removeItem(favoriteStorageKey);
}
},
[setFavoriteKey, favoriteStorageKey],
);

return (
<Dropdown_
{...props}
bookmarks={bookmarks}
onBookmark={onBookmark}
favoriteKey={favoriteKey}
onFavorite={setFavoriteKey}
onFavorite={onFavorite}
/>
);
};
Expand Down

0 comments on commit b05cbe0

Please sign in to comment.