Skip to content

Commit 2706754

Browse files
feedback + changelog
1 parent af9d6a2 commit 2706754

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Fixed
1515
- 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)
1617

1718
### Changed
1819
- Bumped AI SDK and associated packages version. [#444](https://github.com/sourcebot-dev/sourcebot/pull/444)

packages/web/src/features/chat/components/chatThread/chatThread.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)