Skip to content

fix(renderer): sync Redux store during streaming and migrate topic creation to Data API#13295

Merged
0xfullex merged 5 commits intov2from
v2-work
Mar 8, 2026
Merged

fix(renderer): sync Redux store during streaming and migrate topic creation to Data API#13295
0xfullex merged 5 commits intov2from
v2-work

Conversation

@DeJeune
Copy link
Collaborator

@DeJeune DeJeune commented Mar 7, 2026

What this PR does

Before this PR:

  • Streaming updates (blocks and messages) were only written to the cache service, causing the Redux store to be out of sync during streaming, leading to UI not reflecting real-time streaming state.
  • Topic creation in Inputbar used Dexie (db.topics.add) directly, which is being removed in v2.

After this PR:

  • StreamingService temporarily dispatches to the Redux store alongside cache updates, keeping the UI in sync during streaming.
  • Topic creation uses dataApiService.post('/topics', ...) with the server-returned data, aligning with the v2 Data API architecture.
  • A mapLegacyTopicToDto helper bridges the legacy Topic type to CreateTopicDto during migration.
image

Why we need it and why it was done in this way

The following tradeoffs were made:

  • The Redux dispatches in StreamingService are marked as temporary (TODO: temp fix) and will be removed after the full message refactoring is complete. This is a pragmatic bridge to keep the UI working during the v2 migration.

The following alternatives were considered:

  • Fully refactoring the message/block rendering to use cache-only — deferred to a later phase.

Breaking changes

None

Special notes for your reviewer

The Redux dispatches in StreamingService are intentionally temporary. They exist to bridge the gap between the new cache-based streaming architecture and the existing Redux-dependent UI components.

Checklist

  • PR: The PR description is expressive enough and will help future contributors
  • Code: Write code that humans can understand and Keep it simple
  • Refactor: You have left the code cleaner than you found it (Boy Scout Rule)
  • Upgrade: Impact of this change on upgrade flows was considered and addressed if required
  • Documentation: N/A — internal refactoring, no user-facing changes
  • Self-review: I have reviewed my own code

Release note

NONE

…eation to Data API

- Add temporary Redux dispatches in StreamingService to keep store in
  sync with cache-based streaming updates (blocks and messages)
- Replace Dexie db.topics.add with dataApiService.post for topic creation
  in Inputbar, using server-returned data
- Add mapLegacyTopicToDto helper in AssistantService for v2 migration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DeJeune DeJeune requested a review from a team March 7, 2026 19:39
@DeJeune DeJeune added this to the v2.0.0 milestone Mar 7, 2026
@DeJeune DeJeune added the v2 label Mar 7, 2026
@DeJeune DeJeune marked this pull request as draft March 7, 2026 19:43
DeJeune and others added 3 commits March 8, 2026 03:48
…l topics

- Create DataApiMessageDataSource that fetches messages via
  GET /topics/:topicId/messages and converts shared format back
  to renderer Message + MessageBlock format
- Update DbService.fetchMessages to route normal topics through
  the Data API, keeping agent sessions on the existing path
- Handle NOT_FOUND gracefully for pre-migration topics
- Map shared MessageStats to renderer usage/metrics fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DeJeune DeJeune marked this pull request as ready for review March 8, 2026 01:08
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DeJeune DeJeune requested a review from 0xfullex March 8, 2026 01:14
@0xfullex 0xfullex merged commit 4c4ec4c into v2 Mar 8, 2026
8 checks passed
@0xfullex 0xfullex deleted the v2-work branch March 8, 2026 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants