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 @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
14
14
### Fixed
15
15
- Removed prefix from structured log output. [ #443 ] ( https://github.com/sourcebot-dev/sourcebot/pull/443 )
16
+ - [ ask sb] Fixed long generation times for first message in a chat thread. [ #447 ] ( https://github.com/sourcebot-dev/sourcebot/pull/447 )
16
17
17
18
### Changed
18
19
- 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 = ({
141
141
variant : "destructive" ,
142
142
} ) ;
143
143
}
144
+ // Refresh the page to update the chat name.
145
+ router . refresh ( ) ;
144
146
} ) ;
145
147
}
146
148
} , [
@@ -151,14 +153,25 @@ export const ChatThread = ({
151
153
toast ,
152
154
chatId ,
153
155
domain ,
156
+ router ,
154
157
] ) ;
155
158
156
159
157
160
const messagePairs = useMessagePairs ( messages ) ;
158
161
159
162
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." ) ,
162
175
} ) ;
163
176
164
177
// 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