Skip to content

Show "Saving..." indicator when task is being updated 馃捑#482

Description

@anoopcodehack

Show "Saving..." indicator when task is being updated 馃捑

File: client/src/context/BoardContext.jsx

Tasks update silently 馃拃
Users don't know if changes saved fr!!

Fix: add saving state to context:
const [saving, setSaving] = useState(false)

const updateTask = async (id, updates) => {
try {
setSaving(true)
const { data } = await axios.put(
/api/tasks/${id}, updates, authHeaders()
)
setTasks(prev => prev.map(t =>
t._id === id ? data : t
))
} catch (err) {
console.error(err)
throw err
} finally {
setSaving(false)
}
}

// expose saving in context value
// show in Dashboard.jsx navbar:
{saving && (

馃捑 saving...

)}

~10 lines across 2 files! 馃幆
No backend needed!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions