- 
                Notifications
    
You must be signed in to change notification settings  - Fork 358
 
Open
Labels
Description
Wave SDK Version, OS
Wave 1.1.1
Apple M3 Max Sonoma 14.1 (also seen on a Windows machine)
Safari (also tested in Chrome)
Actual behavior
When users type into a chatbot but do not click enter, and then interact with another element, the Submitted element is incorrect.
Expected behavior
Users can type into a chatbot, do other stuff, and then submit later and the chatbot knows it was submitted.
Steps To Reproduce
While running the following app:
- type into the chatbot but do not submit
 - Click the filter button to open the side panel which has a trigger element.
 - Click away from the side panel to close it - do not click on the trigger element.
 - Click submit on the chatbot.
 
The value of __wave_submission_name__ will be the trigger element instead of the chatbot.
from h2o_wave import main, app, Q, ui, data, on, run_on
@app('/')
async def serve(q: Q):
    if not q.client.initialize:
        q.page["meta"] = ui.meta_card("")
        q.page["filter"] = ui.form_card(
            box="6 1 1 1",
            items=[ui.button(name="filter_button", label="Click Me!", primary=True)]
        )
        q.page['chatbot_card'] = ui.chatbot_card(
            box='1 1 5 5',
            name='chatbot',
            data=data(fields='content from_user', t='list', rows=[q.client.chat_history]),
        )
        q.client.agency_list = ["test1", "test2"]
        q.client.selected_agency = None
        q.client.initialize = True
    if q.args.filter_button:
        # The user wants to do some filtering
        q.page["meta"].side_panel = ui.side_panel(
            title="Filter",
            items=[
                ui.choice_group(
                    name="agency_filter", label="Agency Filter",
                    choices=[ui.choice(a, a) for a in q.client.agency_list],
                    value=q.client.selected_agency, trigger=True
                ),
            ]
        )
    if q.args.agency_filter:
        # This is on a trigger and calls when someone has clicked any agency option
        q.client.selected_agency = q.args.agency_filter
        q.page["meta"].notification_bar = ui.notification_bar(
            text="Your option was saved!"
        )
    if q.args.__wave_submission_name__ == "chatbot":
        q.page['chatbot_card'].data += ["👤" + q.args.chatbot, True]
        q.page['chatbot_card'].data += ["🤖 I am just a demo", False]
    await q.page.save()