import of reflex_chat results in error
Describe the bug Encountered a StateValueError when trying to import and use chat from the reflex_chat package. The error indicates that the substate class has been defined multiple times, which results in shadowing conflicts within the reflex_chat library’s state management.
To Reproduce Steps to reproduce the behavior:
pip install reflex reflex-chat
import reflex as rx from reflex_chat import chat, api
Expected behavior The chat instance should initialize without errors, allowing usage of reflex_chat without conflicts or state duplication issues.
Specifics (please complete the following information):
- Python Version: Python 3.11.2
- Reflex Version: 0.6.4
- OS: ubuntu 20.0.1
Additional context The full error traceback is as follows:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/path/to/site-packages/reflex_chat/__init__.py", line 1, in <module>
from .chat import *
File "/path/to/site-packages/reflex_chat/chat.py", line 160, in <module>
c1 = chat()
^^^^^^
File "/path/to/site-packages/reflex_chat/chat.py", line 59, in create
return super().create(
^^^^^^^^^^^^^^^
File "/path/to/site-packages/reflex/state.py", line 2317, in create
component_state = type(
^^^^^
File "/path/to/site-packages/pydantic/v1/main.py", line 282, in __new__
cls = super().__new__(mcs, name, bases, new_namespace, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen abc>", line 106, in __new__
File "/path/to/site-packages/reflex/state.py", line 2287, in __init_subclass__
super().__init_subclass__(mixin=mixin, **kwargs)
File "/path/to/site-packages/reflex/state.py", line 476, in __init_subclass__
raise StateValueError(
reflex.utils.exceptions.StateValueError: The substate class 'reflex___istate___dynamic____chat_n1' has been defined multiple times. Shadowing substate classes is not allowed.
This issue might be due to repeated initializations or conflicts within the library’s state management.
I didn't manage to reproduce that error.
Are you still running into this on latest main?