From cf504fe49207ec71e0f66340e86fc8d697b437ab Mon Sep 17 00:00:00 2001 From: Cameron Yick Date: Thu, 20 Apr 2023 01:06:47 -0400 Subject: [PATCH] prf: add JS handling for situations where tables have no rows --- datasette/static/datasette-manager.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/datasette/static/datasette-manager.js b/datasette/static/datasette-manager.js index 6ca129013b..d3399ae686 100644 --- a/datasette/static/datasette-manager.js +++ b/datasette/static/datasette-manager.js @@ -93,6 +93,11 @@ const datasetteManager = { renderAboveTablePanel: () => { const aboveTablePanel = document.querySelector(DOM_SELECTORS.aboveTablePanel); + + if (!aboveTablePanel) { + console.warn('This page does not have a table, the renderAboveTablePanel cannot be used.'); + } + let aboveTablePanelWrapper = aboveTablePanel.querySelector('.panels'); // First render: create wrappers. Otherwise, reuse previous.