-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rx.input rendered value its not same as state value #4629
Comments
The state vars in your example are bound to To work around this, you can set |
@masenf Can you explain how to use key? Becausue chaning default_value to key, or having them both on MathState.a and etc does not work. |
Changing on blur to on change and. adding debounce got me expected behavior a_component = rx.vstack(rx.heading("a", size='4'), rx.input(id='aid', value=MathState.a, name="a", on_change=MathState.update_a.debounce(300)))
b_component = rx.vstack(rx.heading("b", size='4'), rx.input(id='bid', value=MathState.b, name="b", on_change=MathState.update_b.debounce(300)))
c_component = rx.vstack(rx.heading("c", size='4'), rx.input(id='cid', value=MathState.c, name="c", on_change=MathState.update_c.debounce(300))) |
This issue is likely caused by the way Reflex is handling state synchronization between the backend and frontend. When the state updates, the frontend is not receiving or reacting to the changes as expected. Below is a modified version of your code that ensures the state updates properly reflect on the frontend.
|
Describe the bug
After app start. When for example I change value of a, b or c. events is triggerred succesfully and for example if I change b -> 10 i see log
From: b {'a': '1', 'b': '10', 'c': '11'}
and on fronted a = 1, b = 10 and c = 11. But now if I Try to update variable with was updated before (like c from 5 to 11) then log of state is rightFrom: c {'a': '5', 'b': '10', 'c': '15'}
but on fronted nothing change (a=1, b=10 and c = 11). Now i can try to change any of values and nothing happens on fronted but state in logs updated everytime. If I manually refresh page in browser then values on fronted are now synced with state valuesTo Reproduce
Steps to reproduce the behavior:
Expected behavior
Changing any values should alter both state on backend and values of fronted without manually refreshing brower page
Specifics (please complete the following information):
Python 3.11.1
reflex==0.6.8
reflex-chakra==0.6.2
reflex-hosting-cli==0.1.32
Chrome 131.0.6778.86 (Oficjalna wersja) (arm64)
The text was updated successfully, but these errors were encountered: