Skip to content

Fix/clear messages on new project#249

Merged
zomux merged 2 commits intoopenagents-org:developfrom
Edison-A-N:fix/clear-messages-on-new-project
Jan 11, 2026
Merged

Fix/clear messages on new project#249
zomux merged 2 commits intoopenagents-org:developfrom
Edison-A-N:fix/clear-messages-on-new-project

Conversation

@Edison-A-N
Copy link
Copy Markdown
Contributor

Fix: Clear chat messages when creating new project

🐛 Problem

When clicking "New Project" button, the chat messages from the previous project were not cleared, causing confusion for users.

Additionally, when switching between projects, the welcome screen briefly flashed before loading history messages, creating a poor user experience.

✅ Solution

  1. Message Clearing: Added a useEffect hook that listens to route changes and clears messages/project info when:

    • Switching between projects
    • Creating a new project
    • Selecting different templates on the new project page
  2. Loading State: Added isLoadingProject state to show a loading spinner instead of welcome screen while fetching project history, eliminating UI flicker.

🔧 Key Improvements

  • Used location.key to catch navigation even when pathname stays the same
  • Used finally block to ensure loading state is always cleared
  • Only show loading state for existing projects (not for new/pending projects)

🧪 Testing

  • ✅ Switching from project A to project B → messages cleared, loading spinner shown
  • ✅ Clicking "New Project" from existing project → messages cleared immediately
  • ✅ Selecting different template on new project page → messages cleared
  • ✅ Switching from new project to existing project → messages cleared, loading spinner shown
  • ✅ No welcome screen flicker when switching projects

@vercel
Copy link
Copy Markdown

vercel bot commented Jan 11, 2026

@Edison-A-N is attempting to deploy a commit to the Raphael's projects Team on Vercel.

A member of the Team first needs to authorize it.

@zomux zomux merged commit 3542c99 into openagents-org:develop Jan 11, 2026
4 of 5 checks passed
@Edison-A-N Edison-A-N deleted the fix/clear-messages-on-new-project branch January 11, 2026 07:42
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