reflex icon indicating copy to clipboard operation
reflex copied to clipboard

number_input component's on_change event handler sets the state variable as string

Open wongni opened this issue 3 years ago β€’ 2 comments

Describe the bug Looks like the on_change event handler of number_input component sets the state variable as string instead of int.

min_yield <class 'int'> 50
wait  - compiling /...
event - compiled client and server successfully in 270 ms (853 modules)
min_yield <class 'int'> 50
min_yield <class 'int'> 50
<<<< The value is updated in the UI
min_yield <class 'str'> 51
  File "[REDACTED]app.py", line 36, in df
    (df['y'] > self.min_yield / 10)
TypeError: unsupported operand type(s) for /: 'str' and 'int'

To Reproduce Steps to reproduce the behavior:

  • Code/Link to Repo:

Expected behavior The event handler should set the state variable as int.

Screenshots If applicable, add screenshots to help explain your problem.

** Specifics (please complete the following information):**

  • Python Version: 3.9.13
  • Pynecone Version: 0.1.13
  • OS: MacOS
  • Browser (Optional): Firefox

Additional context Add any other context about the problem here.

wongni avatar Jan 24 '23 21:01 wongni

Got it seems to be converting to a string will fix. Thanks for pointing this out

Alek99 avatar Jan 25 '23 00:01 Alek99

Found what's causing this will need to upgrade chakra version seem to be an issue with there lib

Alek99 avatar Feb 06 '23 01:02 Alek99