Compare commits
1 Commits
v0.13.3-de
...
v0.13.3-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c9c1cf21f0 |
@@ -1344,9 +1344,7 @@ function ReasoningStreamOutput(props: {
|
|||||||
if (preRef && preRef.textContent !== nextText) {
|
if (preRef && preRef.textContent !== nextText) {
|
||||||
preRef.textContent = nextText
|
preRef.textContent = nextText
|
||||||
}
|
}
|
||||||
if (followScroll.autoScroll()) {
|
followScroll.restoreAfterRender()
|
||||||
followScroll.restoreAfterRender({ forceBottom: true })
|
|
||||||
}
|
|
||||||
notifyContentRendered()
|
notifyContentRendered()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ function ToolCallDetails(props: {
|
|||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
if (followScroll.autoScroll()) {
|
if (followScroll.autoScroll()) {
|
||||||
scrollHelpers.restoreAfterRender({ forceBottom: true })
|
scrollHelpers.restoreAfterRender()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export interface ToolScrollHelpers {
|
|||||||
registerContainer(element: HTMLDivElement | null, options?: { disableTracking?: boolean }): void
|
registerContainer(element: HTMLDivElement | null, options?: { disableTracking?: boolean }): void
|
||||||
handleScroll(event: Event & { currentTarget: HTMLDivElement }): void
|
handleScroll(event: Event & { currentTarget: HTMLDivElement }): void
|
||||||
renderSentinel(options?: { disableTracking?: boolean }): JSXElement | null
|
renderSentinel(options?: { disableTracking?: boolean }): JSXElement | null
|
||||||
restoreAfterRender(options?: { forceBottom?: boolean }): void
|
restoreAfterRender(): void
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ToolRendererContext {
|
export interface ToolRendererContext {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export interface FollowScrollHelpers {
|
|||||||
registerContainer: (element: HTMLDivElement | null | undefined, options?: { disableTracking?: boolean }) => void
|
registerContainer: (element: HTMLDivElement | null | undefined, options?: { disableTracking?: boolean }) => void
|
||||||
handleScroll: (event: Event & { currentTarget: HTMLDivElement }) => void
|
handleScroll: (event: Event & { currentTarget: HTMLDivElement }) => void
|
||||||
renderSentinel: (options?: { disableTracking?: boolean }) => JSXElement | null
|
renderSentinel: (options?: { disableTracking?: boolean }) => JSXElement | null
|
||||||
restoreAfterRender: (options?: { forceBottom?: boolean }) => void
|
restoreAfterRender: () => void
|
||||||
autoScroll: Accessor<boolean>
|
autoScroll: Accessor<boolean>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ export function createFollowScroll(options: FollowScrollOptions): FollowScrollHe
|
|||||||
return <div ref={setBottomSentinel} aria-hidden="true" class={options.sentinelClassName} style={{ height: "1px" }} />
|
return <div ref={setBottomSentinel} aria-hidden="true" class={options.sentinelClassName} style={{ height: "1px" }} />
|
||||||
}
|
}
|
||||||
|
|
||||||
const restoreAfterRender = (config?: { forceBottom?: boolean }) => {
|
const restoreAfterRender = () => {
|
||||||
const container = scrollContainerRef
|
const container = scrollContainerRef
|
||||||
if (container && hasUserScrollIntent() && !isAtBottom(container)) {
|
if (container && hasUserScrollIntent() && !isAtBottom(container)) {
|
||||||
if (autoScroll()) {
|
if (autoScroll()) {
|
||||||
@@ -195,7 +195,10 @@ export function createFollowScroll(options: FollowScrollOptions): FollowScrollHe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const shouldFollow = config?.forceBottom ?? autoScroll()
|
// Never let a render-time caller force follow mode back on after the user
|
||||||
|
// has already escaped it. Staying pinned should depend on the current
|
||||||
|
// follow state, not on a caller opting into forceBottom.
|
||||||
|
const shouldFollow = autoScroll()
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
restoreScrollPosition(shouldFollow)
|
restoreScrollPosition(shouldFollow)
|
||||||
if (shouldFollow) {
|
if (shouldFollow) {
|
||||||
|
|||||||
Reference in New Issue
Block a user