From 144247a4de277a66a83c5884fd7a7861dd65012e Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 17 Aug 2023 15:07:29 +0200 Subject: [PATCH 1/2] Add more guards to Tabulator rendering pipelines --- panel/models/tabulator.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/panel/models/tabulator.ts b/panel/models/tabulator.ts index 844531e5de..088bc7b688 100644 --- a/panel/models/tabulator.ts +++ b/panel/models/tabulator.ts @@ -601,7 +601,7 @@ export class DataTabulatorView extends HTMLBoxView { get child_models(): LayoutDOM[] { const children = [] for (const idx of this.model.expanded) { - if (this.model.children.has(idx)) + if (this.model.children?.has(idx)) children.push(this.model.children.get(idx)) } return children @@ -617,7 +617,8 @@ export class DataTabulatorView extends HTMLBoxView { this._render_row(row, false) } this._update_children() - this.tabulator.rowManager.adjustTableSize() + if (this.tabulator.rowManager.renderer != null) + this.tabulator.rowManager.adjustTableSize() this.invalidate_layout() }) } @@ -997,7 +998,7 @@ export class DataTabulatorView extends HTMLBoxView { } setSelection(): void { - if (this.tabulator == null || this._selection_updating) + if (this.tabulator == null || this._initializing || this._selection_updating) return const indices = this.model.source.selected.indices; From 89ab1dd4ab6392a6502738405f1e63d45d2fc6d9 Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Thu, 17 Aug 2023 15:38:37 +0200 Subject: [PATCH 2/2] Add wait --- panel/tests/ui/widgets/test_tabulator.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/panel/tests/ui/widgets/test_tabulator.py b/panel/tests/ui/widgets/test_tabulator.py index bca6ff646a..ac8e43911a 100644 --- a/panel/tests/ui/widgets/test_tabulator.py +++ b/panel/tests/ui/widgets/test_tabulator.py @@ -1669,6 +1669,8 @@ def test_tabulator_row_content_expand_from_python_after(page, port, df_mixed): # Expanding the rows after the server is launched widget.expanded = [0, 2] + time.sleep(0.2) + for i in range(len(df_mixed)): row_content = page.locator(f'text="{df_mixed.iloc[i]["str"]}-row-content"') if i in widget.expanded: