Commit b6f2f0e2 authored by erlendoeien's avatar erlendoeien
Browse files

Fix ui update on last delete

parent 364ae224
......@@ -32,12 +32,7 @@ export default function useWishlist() {
// Easier to simply overwrite entire wishlist in state
const fetchWishlist = () => {
listeners.wishlist = onValue(wishlistRef, (snapshot) => {
if (snapshot.exists()) {
// wishlist.value = Object.entries(snapshot.val()).map(([key, value]) => ({
// [key]: value as number,
// }));
wishlist.value = snapshot.val();
}
wishlist.value = snapshot.val();
});
};
......@@ -45,14 +40,12 @@ export default function useWishlist() {
onBeforeUnmount(() => unsubscibeListeners(listeners));
// const isEmpty = computed(() => wishlist.value.length === 0);
const isEmpty = computed(() => Object.keys(wishlist.value).length === 0);
const isEmpty = computed(() => wishlist.value == null || Object.keys(wishlist.value).length === 0);
const addWish = (id: number) => {
push(wishlistRef, id);
};
//TODO: Fix not updating ui after deleting last wishlist
//TODO: Related to having the wishlist as object and not list?
//TODO: Lookinto if all mounting/unmounting can happen in the views for better loading?
const deleteWish = (deleteId: number) => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment