Skip to content

feat: add Save to space button in Nova chat#991

Open
vorflux[bot] wants to merge 3 commits into
mainfrom
vorflux/save-chat-as-document-ui
Open

feat: add Save to space button in Nova chat#991
vorflux[bot] wants to merge 3 commits into
mainfrom
vorflux/save-chat-as-document-ui

Conversation

@vorflux
Copy link
Copy Markdown
Contributor

@vorflux vorflux Bot commented May 22, 2026

feat: add "Save to space" button in Nova chat

Adds a "Save to [space name]" button in the Nova chat toolbar. When clicked, the full conversation transcript is saved as a document in the current space. Re-clicking after more messages updates the same document (upsert by chat ID via the new /chat/save-as-document backend endpoint).

Depends on: supermemoryai/mono — POST /chat/save-as-document endpoint

What changed

apps/web/components/chat/index.tsx

  • saveState ("idle" | "saving" | "saved") and saveStateRef — tracks button state. Ref pattern (matching existing chatIdRef, selectedProjectRef) avoids stale closure in the callback.
  • handleSaveToSpace — POSTs { chatId, projectId, messages } to ${chatApiBase}/chat/save-as-document (uses the existing fallback constant, not raw NEXT_PUBLIC_BACKEND_URL). Sets state to "saving""saved" on success, reverts to "idle" on error.
  • Reset logicsaveState resets to "idle" when:
    • A new assistant message arrives (useEffect on messages)
    • A new chat is started (handleNewChat)
    • The selected space changes (useEffect on chatProject)
      This prevents the button from getting stuck in "Saved to space" across context switches.
  • Button — shown only when messages.length > 0 && !isAutoChatSpace. Disabled while saveState === "saving" or isResponding (prevents saving mid-stream). Shows "Save to [space]" / "Saving..." / "Saved to space".
  • Analytics — calls analytics.chatSavedToSpace({ chat_id, project_id }) on success.

apps/web/lib/analytics.ts

  • New chatSavedToSpace event (matches the pattern of other chat analytics events).

Testing

Unit tests

No existing unit test framework for this Next.js frontend. The component logic was validated through the build + review cycle.

Biome / lint

N/A for supermemory repo (different toolchain from mono).

Integration/browser testing (attempted — timed out)

  • Attempted: The testing subagent was dispatched to run browser-based UI tests verifying the save button renders, transitions state correctly, and produces a document in the space
  • Failure: Task timed out after 3600s during environment setup
  • Partial progress: Subagent received the test plan and execute message but did not complete execution before timeout
  • Unverified: Browser-level verification of button interactions and end-to-end document creation

Manual verification checklist (for reviewer)

  • Open Nova chat with a space selected — "Save to [space name]" button visible after first assistant response
  • Button is absent in auto-space mode
  • Click save: shows "Saving..." then "Saved to space"
  • Start new chat: button resets to unsaved state
  • Switch space: button resets to unsaved state
  • Cannot click while AI is responding
  • Space Documents tab shows the saved document after clicking save

Session Details

Vorflux AI added 2 commits May 22, 2026 14:04
Add a 'Save to [space name]' button in the ChatSidebar component:
- saveState useState to track idle/saving/saved states
- useEffect to reset saveState to idle when new assistant messages arrive
- handleSaveToSpace callback that POSTs to /chat/save-as-document endpoint
- Save button rendered in chatToolbarActions, visible only when messages
  exist and not in auto-space mode

The button shows contextual text: 'Save to {space}', 'Saving...', or
'Saved to space' based on the current save state.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 22, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
supermemory-mcp 27a74ce May 22 2026, 03:15 PM

@graphite-app graphite-app Bot requested a review from Dhravya May 22, 2026 15:11
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 22, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 27a74ce Commit Preview URL

Branch Preview URL
May 22 2026, 03:16 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.

0 participants