Update drag and drop update and sync to db

This commit is contained in:
2025-10-18 13:50:44 +02:00
parent 76fcc64125
commit 4d82d4c4b7
2 changed files with 4 additions and 1 deletions

View File

@@ -134,6 +134,8 @@ export async function updateHabit(id, updates) {
console.warn('Supabase updateHabit error, writing local:', error.message); console.warn('Supabase updateHabit error, writing local:', error.message);
return local.updateHabit(id, updates); return local.updateHabit(id, updates);
} }
// After any update, trigger a sync to ensure all local changes (including categories) are pushed to remote
await syncLocalToRemoteIfNeeded();
} }
export async function deleteHabit(id) { export async function deleteHabit(id) {

View File

@@ -234,7 +234,8 @@ const HomePage = () => {
...Object.values(grouped).flat() ...Object.values(grouped).flat()
]; ];
} }
setTimeout(loadHabits, 0); // reload instantly after update // Force immediate UI update after all updates
loadHabits();
}} }}
> >
<div className="space-y-6"> <div className="space-y-6">