ui.dialog not being re-created
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 371
- Avg merge
- 26d 1h
- Merged PRs (30d)
- 1
Description
This issue is similar to #1687 but the fix (#1724) is provided on the table level. It would be great if there is also fix on the level of rendering and creating of meta cards.
#### Wave SDK Version, OS
Wave 0.24.0
#### Actual behavior
When `ui.dialog` is re-assigned to `q.page['meta'].dialog` it is is re-rendered, but not re-created.
#### Expected behavior
The `ui.dialog` should be re-created including all its children similar to `form` card.
#### Steps To Reproduce
1. Run the app:
```py
from h2o_wave import main, app, Q, ui
columns = [ui.table_column(name='text', label='Column 1', sortable=True)]
rows = [
ui.table_row(name='row1', cells=['Row 1']),
ui.table_row(name='row2', cells=['Row 2'])
]
@app('/demo')
async def serve(q: Q):
if not q.client.initialized:
q.app.rows = rows
q.page['meta'] = ui.meta_card(box='')
q.page['meta'].dialog = ui.dialog(title='Table', width='800px', items=[
ui.table(
name='issues',
columns=columns,
rows=q.app.rows,
groupable=True,
height='600px',
multiple=True,
),
ui.button(name='remove', label='Remove selected', primary=True)
])
q.client.initialized = True
elif q.args.remove:
q.app.rows = [row for row in q.app.rows if row.name not in q.args.issues]
# This should recreate the whole dialog including all its children so the table should be rendered as reset, with initial state (no-group by).
q.page['meta'].dialog = ui.dialog(title='Table', width='800px', items=[
ui.table(
name='issues',
columns=columns,
rows=q.app.rows,
groupable=True,
height='600px',
multiple=True,
),
ui.button(name='remove', label='Remove selected', primary=True)
])
await q.page.save()
```
2. Group by column
3. Select any row(s)
4. Click on the **Remove selected** button
Table should be reset to initial state but it is not.
It is worth to note that other metas (e.g. side panel) could be impacted by the same issue. Also note that example provided won't reproduce the issue in newer Wave versions (after merging #1724) .
Contributor guide
Research direction
Start by reviewing the rendering and creation path for meta cards, focusing on how assigning q.page['meta'].dialog handles ui.dialog children. Compare the behavior with the form card and the table-level fix in #1724, while using #1687 for context. Done means replacing the dialog recreates it and its children, resetting the table state; consider whether other metas such as the side panel share the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100