mirror of
https://github.com/nagaoo0/HabbitGrid.git
synced 2026-01-11 15:34:54 +00:00
Update drag and drop update and sync to db
This commit is contained in:
@@ -134,6 +134,8 @@ export async function updateHabit(id, updates) {
|
||||
console.warn('Supabase updateHabit error, writing local:', error.message);
|
||||
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) {
|
||||
|
||||
@@ -234,7 +234,8 @@ const HomePage = () => {
|
||||
...Object.values(grouped).flat()
|
||||
];
|
||||
}
|
||||
setTimeout(loadHabits, 0); // reload instantly after update
|
||||
// Force immediate UI update after all updates
|
||||
loadHabits();
|
||||
}}
|
||||
>
|
||||
<div className="space-y-6">
|
||||
|
||||
Reference in New Issue
Block a user