Skip to content

Commit

Permalink
safety checks
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Jan 20, 2024
1 parent 3054bfd commit f728b26
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion www/js/classes/tilegrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,8 @@ class DatasetTile {
// generate the epiviz panel + tracks
const epiviznav = document.querySelector(`#epiviznav_${this.tile.tile_id}`);
const plotContainer = document.querySelector(`#tile_${this.tile.tile_id} .card-image`);
if (!plotContainer) return; // tile was removed before data was returned

if (!epiviznav) {
// epiviz container already exists, so only update gneomic position in the browser

Expand All @@ -434,7 +436,6 @@ class DatasetTile {
*/
epivizTemplate(data, plotConfig, extendRangeRatio) {


//TODO: Place in an "includes" script

let epivizTracksTemplate = "";
Expand Down Expand Up @@ -507,6 +508,7 @@ class DatasetTile {
const {plot_json: plotJson} = data;

const plotContainer = document.querySelector(`#tile_${this.tile.tile_id} .card-image`);
if (!plotContainer) return; // tile was removed before data was returned
plotContainer.replaceChildren(); // erase plot

// NOTE: Plot initially is created to a default width but is responsive.
Expand Down Expand Up @@ -560,6 +562,7 @@ class DatasetTile {
const {plot_json: plotJson} = data;

const plotContainer = document.querySelector(`#tile_${this.tile.tile_id} .card-image`);
if (!plotContainer) return; // tile was removed before data was returned
plotContainer.replaceChildren(); // erase plot

// NOTE: Plot initially is created to a default width but is responsive.
Expand Down Expand Up @@ -597,6 +600,7 @@ class DatasetTile {
const {image} = data;

const plotContainer = document.querySelector(`#tile_${this.tile.tile_id} .card-image`);
if (!plotContainer) return; // tile was removed before data was returned
plotContainer.replaceChildren(); // erase plot

const tsnePreview = document.createElement("img");
Expand All @@ -622,6 +626,7 @@ class DatasetTile {
throw new Error (data?.message ? data.message : "Unknown error.")
}
const plotContainer = document.querySelector(`#tile_${this.tile.tile_id} .card-image`);
if (!plotContainer) return; // tile was removed before data was returned
plotContainer.replaceChildren(); // erase plot

colorSVG(data, plotConfig.colors, this, svgScoringMethod);
Expand Down

0 comments on commit f728b26

Please sign in to comment.