@townco/ui 0.1.122 → 0.1.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -287,7 +287,10 @@ const ChatLayoutMessages = React.forwardRef(({ className, children, onScrollChan
|
|
|
287
287
|
if (!hasInitialScrolledRef.current) {
|
|
288
288
|
// Use a small delay to let initial content render
|
|
289
289
|
const timeout = setTimeout(() => {
|
|
290
|
-
|
|
290
|
+
// Only scroll if the content actually overflows the viewport.
|
|
291
|
+
if (container.scrollHeight > container.clientHeight + 1) {
|
|
292
|
+
container.scrollTop = container.scrollHeight;
|
|
293
|
+
}
|
|
291
294
|
hasInitialScrolledRef.current = true;
|
|
292
295
|
}, 100);
|
|
293
296
|
return () => clearTimeout(timeout);
|
|
@@ -375,6 +375,11 @@ export function useScrollToBottom() {
|
|
|
375
375
|
return;
|
|
376
376
|
}
|
|
377
377
|
const scrollIfNeeded = () => {
|
|
378
|
+
// If content doesn't overflow, don't force any programmatic scroll.
|
|
379
|
+
// This avoids "snapping" the first/small streaming message to the top.
|
|
380
|
+
if (container.scrollHeight <= container.clientHeight + 1) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
378
383
|
// Only auto-scroll if user was at bottom and isn't actively scrolling
|
|
379
384
|
if (isAtBottomRef.current && !isUserScrollingRef.current) {
|
|
380
385
|
requestAnimationFrame(() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@townco/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.123",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@radix-ui/react-slot": "^1.2.4",
|
|
50
50
|
"@radix-ui/react-tabs": "^1.1.13",
|
|
51
51
|
"@radix-ui/react-tooltip": "^1.2.8",
|
|
52
|
-
"@townco/core": "0.0.
|
|
52
|
+
"@townco/core": "0.0.101",
|
|
53
53
|
"@types/mdast": "^4.0.4",
|
|
54
54
|
"@uiw/react-json-view": "^2.0.0-alpha.39",
|
|
55
55
|
"class-variance-authority": "^0.7.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"zustand": "^5.0.8"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@townco/tsconfig": "0.1.
|
|
70
|
+
"@townco/tsconfig": "0.1.120",
|
|
71
71
|
"@types/node": "^24.10.0",
|
|
72
72
|
"@types/react": "^19.2.2",
|
|
73
73
|
"@types/unist": "^3.0.3",
|