Skip to content

Fix chat messages not loading on navigation#13

Merged
danielv14 merged 5 commits intomasterfrom
claude/fix-chat-disappearing-Yty1h
Jan 18, 2026
Merged

Fix chat messages not loading on navigation#13
danielv14 merged 5 commits intomasterfrom
claude/fix-chat-disappearing-Yty1h

Conversation

@danielv14
Copy link
Owner

Add useEffect to sync loader data with useChat state when they're
out of sync. This fixes a bug where chat messages would not appear
when navigating from the home page to the reflect page, likely caused
by view transitions or component reuse during SPA navigation.

Add useEffect to sync loader data with useChat state when they're
out of sync. This fixes a bug where chat messages would not appear
when navigating from the home page to the reflect page, likely caused
by view transitions or component reuse during SPA navigation.
@github-actions
Copy link

Move the redirect logic for existing entries from a useEffect in the
component to the loader using TanStack Router's redirect(). This
prevents the component from rendering at all when redirecting, avoiding
any flash of content.
- Save user messages directly in handleSendMessage instead of via effect
- Simplify assistant message effect to only handle the last message after
  streaming completes
- Reduces effect complexity and makes code flow more direct
Instead of using a sync effect workaround, disable view transitions when
navigating to /reflect. This ensures the component fully remounts and
useChat properly picks up initialMessages from the loader.

Remove the sync effect that was added as a workaround.
The view transition disable didn't conclusively fix the issue.
Keep the sync effect as a workaround until root cause is identified.
@danielv14 danielv14 merged commit 6684c34 into master Jan 18, 2026
2 checks passed
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

Comments