Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

By-name component access not working for updated items #2210

Open
marek-mihok opened this issue Nov 28, 2023 · 0 comments
Open

By-name component access not working for updated items #2210

marek-mihok opened this issue Nov 28, 2023 · 0 comments
Assignees
Labels
bug Bug in code

Comments

@marek-mihok
Copy link
Contributor

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.

Screen.Recording.2023-11-27.at.17.13.18.mov

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()
  1. Click the Clear button - sets the content properly.
  2. Click on fox or dog to update form items.
  3. Click the Clear button again.
  4. It does not set the content.
@marek-mihok marek-mihok added the bug Bug in code label Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug in code
Projects
None yet
Development

No branches or pull requests

2 participants