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
When typing fast in any ReactComponent that uses model.useState() for a controlled text input, characters are dropped. This is the React ESM equivalent of the boomerang issue fixed for Bokeh components in PR #7093.
Here is an example from my deployed panel-material-ui ChatInterface application.
panel-material-ui-boomerang.mp4
I typed "boomerang. Sometimes". But it became "boomerang. Sometims". I'm normally only able to reproduce for deployed applications. While developing on my jupyterhub I don't see the issue.
Run with panel serve script.py and type fast — characters will be dropped.
Root Cause
model.useState in panel/models/react_component.ts (lines 497-540) creates a bidirectional sync with no boomerang prevention:
Effect 1 (Python → React): calls setValue(targetModel.attributes[resolvedProp]) on any property change
Effect 2 (React → Python): calls targetModel.setv({prop: value}) when React state changes
The race condition:
User types "a" → setValueInput("a") → Effect 2 sends "a" to Python
User types "b" → setValueInput("ab") → Effect 2 sends "ab" to Python
Python echoes "a" back → Effect 1 fires setValue("a") → overwrites "ab"
Character "b" is lost
Real-world Impact
This affects panel-material-ui ChatInterface and all text input widgets (TextInput, TextAreaInput, PasswordInput, AutocompleteInput) — any component using the model.useState + controlled input pattern.
Precedent
This is the same class of bug fixed for Bokeh components in:
Add boomerang detection to model.useState in react_component.ts. Track values sent to Python via a ref array. When the Python → React callback fires, check if the incoming value is an echo of a locally-sent value — if so, skip the setValue() call.
Description
When typing fast in any
ReactComponentthat usesmodel.useState()for a controlled text input, characters are dropped. This is the React ESM equivalent of the boomerang issue fixed for Bokeh components in PR #7093.Here is an example from my deployed panel-material-ui ChatInterface application.
panel-material-ui-boomerang.mp4
I typed "boomerang. Sometimes". But it became "boomerang. Sometims". I'm normally only able to reproduce for deployed applications. While developing on my jupyterhub I don't see the issue.
AI Disclaimer
Below is AI Generated. I've
Minimal Reproducible Example
Run with
panel serve script.pyand type fast — characters will be dropped.Root Cause
model.useStateinpanel/models/react_component.ts(lines 497-540) creates a bidirectional sync with no boomerang prevention:setValue(targetModel.attributes[resolvedProp])on any property changetargetModel.setv({prop: value})when React state changesThe race condition:
setValueInput("a")→ Effect 2 sends "a" to PythonsetValueInput("ab")→ Effect 2 sends "ab" to PythonsetValue("a")→ overwrites "ab"Real-world Impact
This affects panel-material-ui ChatInterface and all text input widgets (TextInput, TextAreaInput, PasswordInput, AutocompleteInput) — any component using the
model.useState+ controlled input pattern.Precedent
This is the same class of bug fixed for Bokeh components in:
Proposed Fix
Add boomerang detection to
model.useStateinreact_component.ts. Track values sent to Python via a ref array. When the Python → React callback fires, check if the incoming value is an echo of a locally-sent value — if so, skip thesetValue()call.Environment