Persist manual checkbox toggles to server#24
Merged
Conversation
Toggling a task in the UI only saved to localStorage. On refresh, signed-in users would call syncWithServer which overwrites the local todo_markdown with the stale server snapshot, undoing the toggle. Add an /api/tasks endpoint to push task state independently of /api/chat, and call it from toggleTodo.
|
🚅 Deployed to the padtask-pr-24 environment in padtask
|
The collapse state for category headings was keyed globally by section name (padtask-collapsed-<name>), so two chats with the same section title shared state and switching chats appeared to "unsave" the toggle. Store the state on the chat object instead, persisted via saveChats. Also add a test for the /api/tasks DB rejection path to keep functions coverage at 100%.
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
Manually toggling a task checkbox only saved to localStorage. For signed-in users, on refresh
syncWithServerwould pull the staletodo_markdownfrom the server and silently overwrite the toggle.POST /api/tasksto persist just the task list (same ownership rules as/api/chat: guests can update unowned rows, owners can update their own).db.updateTodoMarkdownhelper that only touchestodo_markdown/updated_at.toggleTodonow pushes the new state viapushTaskStateafter updating localStorage.Test plan
/api/taskscover missing args, guest update, owner update, cross-user 403, and no-row case (84 tests pass).Generated by Claude Code