From 94c15b6b52f754f1afbd1fdd5772338dd89d62c0 Mon Sep 17 00:00:00 2001 From: adkinsrs Date: Thu, 18 Jan 2024 22:55:52 -0500 Subject: [PATCH] fixing bug where old tilegrid was not cleared --- www/js/classes/tilegrid.js | 3 +++ www/js/expression.js | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/www/js/classes/tilegrid.js b/www/js/classes/tilegrid.js index e3231e57..89eedb3e 100644 --- a/www/js/classes/tilegrid.js +++ b/www/js/classes/tilegrid.js @@ -54,6 +54,9 @@ class TileGrid { const tilegrid = isMulti ? this.tilegrid.multi : this.tilegrid.single; const selector = this.selector; + // Clear selector element + document.querySelector(selector).replaceChildren(); + // All child tiles fit into a single parent in a vertical sense. // If "is-vertical" is present, all children tiles will be stacked vertically // If "tile" class does not have "is-vertical", then children tiles will be stacked horizontally diff --git a/www/js/expression.js b/www/js/expression.js index 22936402..4ecfa135 100644 --- a/www/js/expression.js +++ b/www/js/expression.js @@ -44,7 +44,7 @@ document.addEventListener('DOMContentLoaded', () => { }); // add event listener for when the submit-expression-search button is clicked - document.querySelector('#submit-expression-search').addEventListener('click', (event) => { + document.querySelector('#submit-expression-search').addEventListener('click', async (event) => { // TODO: If I clear the gene symbol search, then click, the gene symbol is not updated and passes validation below - SAdkins const status = validateExpressionSearchForm(); @@ -54,9 +54,11 @@ document.addEventListener('DOMContentLoaded', () => { return; } - // These can next be wrapped in a Promise.all() call for auto-first-gene selection if we want. - fetchGeneAnnotations(); - setupTileGrid(selected_dc_share_id); + try { + await Promise.allSettled([fetchGeneAnnotations(),setupTileGrid(selected_dc_share_id)]); + } catch (error) { + logErrorInConsole(error); + } }); // handle when the organism-selector select box is changed