Skip to content

Persist manual checkbox toggles to server#24

Merged
super3 merged 2 commits into
mainfrom
claude/confident-archimedes-un45D
May 21, 2026
Merged

Persist manual checkbox toggles to server#24
super3 merged 2 commits into
mainfrom
claude/confident-archimedes-un45D

Conversation

@super3
Copy link
Copy Markdown
Owner

@super3 super3 commented May 21, 2026

Summary

Manually toggling a task checkbox only saved to localStorage. For signed-in users, on refresh syncWithServer would pull the stale todo_markdown from the server and silently overwrite the toggle.

  • Add POST /api/tasks to persist just the task list (same ownership rules as /api/chat: guests can update unowned rows, owners can update their own).
  • Add db.updateTodoMarkdown helper that only touches todo_markdown / updated_at.
  • Frontend toggleTodo now pushes the new state via pushTaskState after updating localStorage.

Test plan

  • Unit tests for /api/tasks cover missing args, guest update, owner update, cross-user 403, and no-row case (84 tests pass).
  • Manual: sign in, toggle a task, refresh — toggle should persist.
  • Manual: same toggle on a second device after a few seconds — state should match.

Generated by Claude Code

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.
@railway-app railway-app Bot temporarily deployed to padtask / padtask-pr-24 May 21, 2026 22:32 Destroyed
@railway-app
Copy link
Copy Markdown

railway-app Bot commented May 21, 2026

🚅 Deployed to the padtask-pr-24 environment in padtask

Service Status Web Updated (UTC)
padtask ✅ Success (View Logs) Web May 21, 2026 at 10:35 pm

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%.
@railway-app railway-app Bot temporarily deployed to padtask / padtask-pr-24 May 21, 2026 22:35 Destroyed
@super3 super3 merged commit 88a4527 into main May 21, 2026
3 checks passed
@super3 super3 deleted the claude/confident-archimedes-un45D branch May 21, 2026 22:39
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.

2 participants