Chat component returning KeyError: "Element ipyvuetify.TextField(label = 'Type a message...' #464
Replies: 3 comments 1 reply
-
Hi @francesfeng! You're right that I tried quickly to replicate what you described, but exporting and importing the example as a component and worked fine for me. Could you maybe share some of the related code, so I can take a look.
Indeed, there it should use |
Beta Was this translation helpful? Give feedback.
-
To follow up, I managed to accidentally replicate your issue while working on something unrelated today. In my case the issue was fixed by updating reacton. |
Beta Was this translation helpful? Give feedback.
-
I fixed the use_reactive/reactive mistake, thank you for reporting that @francesfeng ! |
Beta Was this translation helpful? Give feedback.
-
Hi,
I tried the last 2 code examples provided here https://solara.dev/api/chat, it runs fine as a stand alone .py file, but shows the following error if export as a component, and used in a package.
File "./site-packages/reacton/core.py", line 743, in get_widget raise KeyError(f"Element {el} was found to be in a previous render, you may have used a stale element") KeyError: "Element ipyvuetify.TextField(label = 'Type a message...', v_model = '', on_v_model = <function ...11e7364c0>, rounded = True, filled = True, hide_details = True, style_ = 'flex-grow: 1;', disabled = False) was found to be in a previous render, you may have used a stale element"
I checked the source code quickly, think a possible reason is that ChatInput component doesn't return a value. source code here
It solves the problem by returning
message_input
, but it would then lose the button component. Would be good to hear how you'd address this issue.Btw, also in the last 2 code examples on the website, I think it should use
messages = solara.Reactive([])
instead ofmessages = solara.use_reactive([])
?Beta Was this translation helpful? Give feedback.
All reactions