File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
packages/web/src/features/chat/components/chatThread Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
1313### Fixed
1414- Removed prefix from structured log output. [ #443 ] ( https://github.com/sourcebot-dev/sourcebot/pull/443 )
15+ - [ ask sb] Fixed long generation times for first message in a chat thread. [ #447 ] ( https://github.com/sourcebot-dev/sourcebot/pull/447 )
1516
1617### Changed
1718- Bumped AI SDK and associated packages version. [ #444 ] ( https://github.com/sourcebot-dev/sourcebot/pull/444 )
Original file line number Diff line number Diff line change @@ -141,6 +141,8 @@ export const ChatThread = ({
141141 variant : "destructive" ,
142142 } ) ;
143143 }
144+ // Refresh the page to update the chat name.
145+ router . refresh ( ) ;
144146 } ) ;
145147 }
146148 } , [
@@ -151,14 +153,25 @@ export const ChatThread = ({
151153 toast ,
152154 chatId ,
153155 domain ,
156+ router ,
154157 ] ) ;
155158
156159
157160 const messagePairs = useMessagePairs ( messages ) ;
158161
159162 useNavigationGuard ( {
160- enabled : status === "streaming" || status === "submitted" ,
161- confirm : ( ) => window . confirm ( "You have unsaved changes that will be lost." )
163+ enabled : ( { type } ) => {
164+ // @note : a "refresh" in this context means we have triggered a client side
165+ // refresh via `router.refresh()`, and not the user pressing "CMD+R"
166+ // (that would be a "beforeunload" event). We can safely peform refreshes
167+ // without loosing any unsaved changes.
168+ if ( type === "refresh" ) {
169+ return false ;
170+ }
171+
172+ return status === "streaming" || status === "submitted" ;
173+ } ,
174+ confirm : ( ) => window . confirm ( "You have unsaved changes that will be lost." ) ,
162175 } ) ;
163176
164177 // When the chat is finished, refresh the page to update the chat history.
You can’t perform that action at this time.
0 commit comments