continue
continue copied to clipboard
Prevent going back to previous session when changing modes on a new initialized session
Description
This happens when we change the modes. Currently when we open a new session by clicking on the new session button, we go back to the previous session as we change mode from edit to chat/agent.
This should not happen because the user explicitly asked for a new chat session.
This PR fixes this by tracking when a new session was explicitly initialized then we do not go back to previous sessions on any mode change.
Checklist
- [] I've read the contributing guide
- [] The relevant docs, if any, have been updated or created
- [] The relevant tests, if any, have been updated or created
Screenshots
https://github.com/user-attachments/assets/cb9f49a9-d6f8-46b6-ac8a-0012608e5a81
https://github.com/user-attachments/assets/f5e80ba4-fecd-476f-a1a7-771dd00006e1
Testing instructions
- Click on a new chat session plus button on the top right.
- Change the mode to edit.
- Now change the mode to chat or agent.
- See that new session is preserved without going back to the previous session unexpectedly.