You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(chat): measure the observer's first delivery like any other
The width can change between the mount-time measure and observe(), so
treating the first notification as confirmation of the mount width dropped
that change and left the stale height in place.
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.test.tsx
+35-14Lines changed: 35 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -33,9 +33,12 @@ let editorWidth = 700
33
33
letautosizeCalls=0
34
34
35
35
/**
36
-
* Mirrors the real observer's contract closely enough to test the width guard:
37
-
* `observe` delivers an initial notification for the current size (browsers do),
38
-
* and {@link resizeTo} delivers subsequent ones.
36
+
* Mirrors the real observer's contract closely enough to test the width guard.
37
+
* `observe` only registers the target — real deliveries, including the initial
38
+
* one browsers send, are asynchronous, so every test drives them explicitly via
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/prompt-editor/prompt-editor.tsx
+5-4Lines changed: 5 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -112,18 +112,19 @@ export function PromptEditor({
112
112
*
113
113
* Only width is compared: `autosize` writes the textarea's height, which grows
114
114
* the scroller until its cap and re-notifies this observer, so reacting to
115
-
* height would feed itself. The first delivery reports the width the
116
-
* mount-time measure already used, so it is recorded without re-measuring.
115
+
* height would feed itself. The first delivery is measured like any other —
116
+
* the width can change between the mount-time measure and `observe()`, and
117
+
* re-measuring an unchanged width only writes the same height back.
0 commit comments