Bug Description
When filling in textarea parameters on the Create Workspace page, users experience dropped characters, input lag, and inconsistent text during typing. The textarea intermittently reverts to an earlier state, causing typed characters to disappear.
Root Cause
The useSyncFormParameters hook overwrites form values with stale WebSocket responses. The sequence:
- User types
abc in a textarea parameter
- After a 500ms debounce, the value
abc is sent to the server via WebSocket
- User continues typing — form now holds
abcde
- The server responds with
abc (echo of what was sent)
useSyncFormParameters sees the server value differs from the form value, overwrites the form back to abc
- The characters
de are lost
Since the textarea is a fully controlled React component, the overwritten form value immediately propagates to the DOM, causing the visible snap-back.
Expected Behavior
Characters typed after the WebSocket request should not be lost. The sync hook should detect that a server response is stale (an echo of what was sent, not a server-side transformation) and preserve the user's in-progress input.
Affected Components
site/src/modules/hooks/useSyncFormParameters.ts — always applies server value when param.value.valid is true
site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx — calls the sync hook without stale-response awareness
site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx — textarea is fully controlled, fires onChange on every keystroke
Bug Description
When filling in textarea parameters on the Create Workspace page, users experience dropped characters, input lag, and inconsistent text during typing. The textarea intermittently reverts to an earlier state, causing typed characters to disappear.
Root Cause
The
useSyncFormParametershook overwrites form values with stale WebSocket responses. The sequence:abcin a textarea parameterabcis sent to the server via WebSocketabcdeabc(echo of what was sent)useSyncFormParameterssees the server value differs from the form value, overwrites the form back toabcdeare lostSince the textarea is a fully controlled React component, the overwritten form value immediately propagates to the DOM, causing the visible snap-back.
Expected Behavior
Characters typed after the WebSocket request should not be lost. The sync hook should detect that a server response is stale (an echo of what was sent, not a server-side transformation) and preserve the user's in-progress input.
Affected Components
site/src/modules/hooks/useSyncFormParameters.ts— always applies server value whenparam.value.validis truesite/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx— calls the sync hook without stale-response awarenesssite/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx— textarea is fully controlled, fires onChange on every keystroke