Skip to content

Conversation

@MODSetter
Copy link
Owner

@MODSetter MODSetter commented Nov 7, 2025

Description

feat: fix chat initialization logic in ResearcherPage

Motivation and Context

FIX #

Screenshots

API Changes

  • This PR includes API changes

Change Type

  • Bug fix
  • New feature
  • Performance improvement
  • Refactoring
  • Documentation
  • Dependency/Build system
  • Breaking change
  • Other (specify):

Testing Performed

  • Tested locally
  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR fixes a bug in the chat initialization logic for the ResearcherPage where default source connectors were being repeatedly set on every render. The fix introduces a useRef flag to ensure that the initial connectors are only set once when a new chat is created, preventing unnecessary re-initialization. The flag is properly reset when switching between different chats.

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_web/app/dashboard/[search_space_id]/researcher/[[...chat_id]]/page.tsx

Need help? Join our Discord

Analyze latest changes

- Introduced a ref to track if initial connectors have been set for new chats.
- Updated the effect to reset the flag when the chat ID changes, ensuring connectors are set only once on initial mount.
- Improved the condition for setting default sources for new chats to prevent unnecessary updates.
@MODSetter MODSetter merged commit ed348b1 into main Nov 7, 2025
5 of 6 checks passed
@vercel
Copy link

vercel bot commented Nov 7, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
surf-sense-frontend Building Building Preview Comment Nov 7, 2025 8:22pm

Copy link

@recurseml recurseml bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RecurseML

🔍 Review performed on a9c9e3f..461d6ab

✨ No bugs found, your code is sparkling clean

✅ Files analyzed, no issues (1)

surfsense_web/app/dashboard/[search_space_id]/researcher/[[...chat_id]]/page.tsx

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