mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
fix: defer padding recalculation to avoid race condition with DOM updates
This commit is contained in:
parent
84ea96c394
commit
68dda10852
1 changed files with 9 additions and 5 deletions
|
|
@ -16,11 +16,15 @@
|
|||
export let chatContainer: HTMLDivElement;
|
||||
|
||||
export function onFinishedSubmitting() {
|
||||
if (lastAssistantMessageElement && lastAssistantMessageElement.offsetHeight <
|
||||
chatContainer.offsetHeight - parseFloat(getComputedStyle(chatContainer).padding) * 2) {
|
||||
// Recalculate padding when streaming ends to fix race condition with streaming indicator removal
|
||||
assistantMessageAction(lastAssistantMessageElement);
|
||||
}
|
||||
tick().then(() => {
|
||||
requestAnimationFrame(() => {
|
||||
if (lastAssistantMessageElement && lastAssistantMessageElement.offsetHeight <
|
||||
chatContainer.offsetHeight - parseFloat(getComputedStyle(chatContainer).padding) * 2) {
|
||||
// Recalculate padding when streaming ends to fix race condition with streaming indicator removal
|
||||
assistantMessageAction(lastAssistantMessageElement);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
let thoughtElement: HTMLElement | undefined;
|
||||
|
|
|
|||
Loading…
Reference in a new issue