Fix done status not persisting after reload - #42
Merged
Merged
Conversation
Root cause: patchMeTask encoded task paths as classId%2FtaskId and on 404/405/501 silently stubbed success in memory, so the UI showed done without a server write. Prefer tilde refs (classId~taskId) matching Brief, POST done/undo first for completion, never stub completed writes, and sync finished[] from the user doc into task_states. Co-authored-by: Sander Vonk <sandervonk@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Marking a task done in the Vue Portal updated the UI immediately but did not survive a full reload. Root cause was on the Vue client (with API contract notes below).
Cause
patchMeTasktreated404/405/501as success and returned an in-memory stub.set_finishedthen applied that stub totask_statesand showed a success toast. Nothing was written server-side, so reload cleared done.PATCH /api/v1/me/tasks/:taskIdwith URL-encoded slash paths (classId%2FtaskId). Live API / Brief docs prefer board tilde refs (classId~taskId). Encoded/is brittle on single-segment Express routes behind Firebase Hosting; Brief batch done works because it sends tilde ids in the JSON body, not as path segments with%2F.finished[]snapshot updatedaccount_docbut did not merge intotask_states(whichis_task_completedprefers).Fix (Vue only)
/me/tasks/:taskIdwith tilde refs (classId~taskId); never put%2Fin the path segment.POST .../done/.../undo(and batchPOST /api/v1/me/tasks/done|undofor multi-select) for completion — same contract Brief uses.id+ numericcompleted_at.users.finished[]intotask_stateson snapshot (including undo clears).Tests
npm run test:me-tasks— board state mergenpm run test:paths— tilde encoding / normalize helpers (asserts no%2F)Follow-up on mvtt-server (no PR there from this change)
PATCH /api/v1/me/tasks/:taskId+task_state(functions/api/routes/workspace.ts/services/taskState.ts). README still documents done/undo more prominently than PATCH.%2Fpath params more clearly, or document that clients must use tilde refs for:taskId(Brief already does).GET /api/v1/me/boardtasks[].completed/finished[]stay aligned with hybrid hot maps after undo (Vue now dual-reads both).No Drive OAuth, nested delete, or unrelated workspace UI changes.