Skip to content

Sync section collapse state across devices#27

Open
super3 wants to merge 2 commits into
mainfrom
claude/awesome-noether-dKJ1B
Open

Sync section collapse state across devices#27
super3 wants to merge 2 commits into
mainfrom
claude/awesome-noether-dKJ1B

Conversation

@super3
Copy link
Copy Markdown
Owner

@super3 super3 commented May 21, 2026

Summary

  • The per-section collapsed/expanded map was only written to localStorage, so a different device or private tab never saw it on refresh.
  • Persist collapsedSections on the server (new collapsed_sections JSONB column) alongside todo_markdown, push on toggle, and adopt it during cross-device sync.

Changes

  • New migration 005_add-collapsed-sections-to-conversations.cjs adds the JSONB column with '{}'::jsonb default.
  • db.js: include collapsed_sections in getConversation and listConversationsByUser; add updateCollapsedSections(sessionId, userId, sections) with the same ownership rule as updateTodoMarkdown.
  • server.js: new POST /api/collapsed-sections endpoint; enforces ownership via canAccess, rejects non-object bodies.
  • index.html: on heading click, push the updated map to the server alongside the existing saveChats(); mergeServerConversations adopts server-side collapsedSections for both existing and newly-discovered chats.

Test plan

  • Toggle a section on device A, refresh device B (or a fresh private tab) and confirm the same sections are collapsed.
  • Toggling still works for guest (unauthenticated) sessions.
  • Existing chats without the column behave correctly (default {}).
  • jest (couldn't run locally due to restricted registry — please verify in CI).

Generated by Claude Code

The per-section collapsed/expanded map was only written to localStorage, so
a different device or private tab never saw it. Persist it on the server
alongside todo_markdown and adopt it during cross-device sync.
@railway-app railway-app Bot temporarily deployed to padtask / padtask-pr-27 May 21, 2026 22:56 Destroyed
@railway-app
Copy link
Copy Markdown

railway-app Bot commented May 21, 2026

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

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

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