Skip to content

Show tasks immediately upon creation with optimistic UI - #3327

Open
corbin-auriti wants to merge 1 commit into
nextcloud:mainfrom
corbin-auriti:optimistic-task-creation
Open

corbin-auriti wants to merge 1 commit into
nextcloud:mainfrom
corbin-auriti:optimistic-task-creation

Conversation

@corbin-auriti

Copy link
Copy Markdown

Summary

Creating a task (or duplicating one) currently waits for the CalDAV request to finish before the task appears in the UI, which makes adding tasks feel sluggish, especially on remote or slower servers.

This PR makes task creation and duplication optimistic:

  • the task is added to the store (and calendar/parent relations) immediately with a "synchronizing" status, so it renders right away
  • once the server responds, the DAV object is attached through the store's reactive proxy, the sync status turns to success, and any updates queued while the request was running are flushed
  • if the task was deleted locally while the request was in flight, the server-side copy is removed again
  • on failure the optimistic state is fully rolled back and an error notification is shown

Only src/store/tasks.js is touched; the diff applies cleanly on current main.

Testing

  • create a task → it appears instantly, checkmark after sync
  • duplicate a task → same
  • kill network before creating → task disappears again, "Could not create the task." error appears
  • delete a brand-new task while it is still syncing → no orphan on the server

Signed-off-by: Corbin Auriti corbin@no-bs.ca

Tasks now appear in the UI right away while the CalDAV request to the
server is still running. On success the DAV object is attached through
the store's reactive proxy and any updates queued during the request are
flushed. On failure the optimistic state is rolled back and an error is
shown. The same treatment is applied to duplicating tasks.

This makes creating and duplicating tasks feel instant, especially on
slower servers or remote connections.

Signed-off-by: Corbin Auriti <corbin@no-bs.ca>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant