reflex icon indicating copy to clipboard operation
reflex copied to clipboard

[REF-3219] use hooks.useState will raise: ValueError: Can not compile, the tag useState is used multiple time from react and react

Open seewindcn opened this issue 1 year ago β€’ 4 comments

Describe the bug A clear and concise description of what the bug is. use hooks.useState, will raise: ValueError: Can not compile, the tag useState is used multiple time from react and react

hooks._compose_react_imports function, create ImportVar object with install=False; and in banner.py, ConnectionToaster.add_hooks create ImportVar object with install=True;

these will make compler.validate_imports raise ValueError.

REF-3219

seewindcn avatar Jul 01 '24 02:07 seewindcn

should be a simple enough fix to get rid of the install=False in _compose_react_imports

masenf avatar Jul 01 '24 17:07 masenf

I think install=Falseis correct though (even if we have a special case that exclude installing react dynamically since it's installed during `init`) I'd rather set it to False in `ConnectionToaster.add_hooks`

Lendemor avatar Jul 03 '24 13:07 Lendemor

We could also merge that patch that moves the install special cases to ImportVar.__init__ or similar. Then it wouldn't matter how it was specified in different places.

masenf avatar Jul 03 '24 16:07 masenf

We could also merge that patch that moves the install special cases to ImportVar.__init__ or similar. Then it wouldn't matter how it was specified in different places.

I'd be fine with that, do you have the id of the PR containing that patch if it's waiting/ready for review?

Lendemor avatar Jul 20 '24 00:07 Lendemor