h2oai / wave

Realtime Web Apps and Dashboards for Python and R
https://wave.h2o.ai
Apache License 2.0
3.98k stars 328 forks source link

New values in ui.combobox trigger a button submission #2342

Closed pascal-pfeiffer closed 3 months ago

pascal-pfeiffer commented 3 months ago

Wave SDK Version, OS

h2o-wave 1.2.0

Actual behavior

Minimum code example:

from h2o_wave import Q, app, main, ui

@app("/")
async def serve(q: Q):
    print(q.args)
    q.page['example'] = ui.form_card(box='1 1 2 2', items=[
        ui.combobox(
            name="my_coolest_combobox",
            label="Selection",
            values=["choice1"],
            required=False,
            choices=["choice1", "choice2"],
            trigger=True,
        ),
        ui.button(
            name="i_am_a_button",
            label=(
                "Don't click me"
            ),
            primary=True,
        )
    ])
    await q.page.save()

When adding a new value to the combobox, I am getting: q.args: __wave_submission_name__:'i_am_a_button'

When selecting an existing value in the combobox, I am getting: q.args: __wave_submission_name__:'my_coolest_combobox'

Expected behavior

In both cases, I would expect the __wave_submission_name__ to be `'my_coolest_combobox'``

Steps To Reproduce

  1. Use minimum code example above
  2. Add an new value to the combobox and wait for the trigger
  3. Select a value from the combobox and wait for the trigger
  4. Compare q.args prints in the console