large mock refector hopefully done + no errors?
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h13m59s

This commit is contained in:
2025-12-21 02:43:03 -08:00
parent 391d00ae15
commit c49e5f7019
77 changed files with 817 additions and 465 deletions

View File

@@ -11,7 +11,7 @@ import type { MasterGroceryItem } from '../types';
* It encapsulates API calls and state updates for adding and removing items.
*/
const useWatchedItemsHook = () => {
const { user } = useAuth();
const { userProfile } = useAuth();
// Get the watched items and the global setter from the DataContext.
const { watchedItems, setWatchedItems } = useUserData();
@@ -27,7 +27,7 @@ const useWatchedItemsHook = () => {
const error = useMemo(() => (addError || removeError ? (addError?.message || removeError?.message) : null), [addError, removeError]);
const addWatchedItem = useCallback(async (itemName: string, category: string) => {
if (!user) return;
if (!userProfile) return;
const updatedOrNewItem = await addWatchedItemApi(itemName, category);
if (updatedOrNewItem) {
@@ -41,17 +41,17 @@ const useWatchedItemsHook = () => {
return currentItems;
});
}
}, [user, setWatchedItems, addWatchedItemApi]);
}, [userProfile, setWatchedItems, addWatchedItemApi]);
const removeWatchedItem = useCallback(async (masterItemId: number) => {
if (!user) return;
if (!userProfile) return;
const result = await removeWatchedItemApi(masterItemId);
if (result === null) {
// Update the global state in the DataContext.
setWatchedItems(currentItems => currentItems.filter(item => item.master_grocery_item_id !== masterItemId));
}
}, [user, setWatchedItems, removeWatchedItemApi]);
}, [userProfile, setWatchedItems, removeWatchedItemApi]);
return {
watchedItems,