wave
wave copied to clipboard
By-name component access not working for updated items
Wave SDK Version, OS
Wave v1.0.0, MacOS 13.5.1, Chrome Version 119.0.6045.159 (Official Build) (arm64)
Actual behavior
Unable to update components using by-name component access inside the items which were previously updated.
https://github.com/h2oai/wave/assets/23740173/c8c80df0-8892-44c8-a62f-e207d78f12f5
Expected behavior
Form text content is updated when clicking on the Clear button.
Steps To Reproduce
Repro code:
from h2o_wave import main, app, Q, ui
def get_form_items(clicked: str):
return [
ui.text(content='The quick brown [fox](?fox) jumps over the lazy [dog](?dog)'),
ui.text(name='text_clicked', content=f'Clicked: {clicked}'),
ui.button(name='clear', label='Clear'),
]
@app('/demo')
async def serve(q: Q):
if not q.client.initialized:
q.page['example'] = ui.form_card(box='1 1 3 2', items=get_form_items('Nothing'))
q.client.initialized = True
if q.args.fox:
q.page['example'].items = get_form_items('fox')
if q.args.dog:
q.page['example'].items = get_form_items('dog')
if q.args.clear:
# Working
# q.page['example'].items[1].text.content = 'Clicked:'
# Not working
q.page['example'].text_clicked.content = 'Clicked:'
await q.page.save()
- Click the Clear button - sets the content properly.
- Click on fox or dog to update form
items. - Click the Clear button again.
- It does not set the content.