Skip to content

Commit

Permalink
remove Current DAO from favorites list
Browse files Browse the repository at this point in the history
  • Loading branch information
Da-Colon committed Apr 3, 2024
1 parent 1cbe52b commit 6235981
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/hooks/DAO/loaders/useFavorites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ export const useAccountFavorites = () => {
const [favoritesList, setFavoritesList] = useState<string[]>([]);

useEffect(() => {
setFavoritesList(getValue(CacheKeys.FAVORITES));
}, [getValue]);
let favorites = getValue(CacheKeys.FAVORITES);
if (!!daoAddress && Array.isArray(favorites) && favorites.includes(daoAddress)) {
favorites = favorites.filter((favorite: string) => favorite !== daoAddress);
}
setFavoritesList(favorites);
}, [getValue, daoAddress]);

/**
* @returns favorited status of loaded safe
Expand Down

0 comments on commit 6235981

Please sign in to comment.