Skip to content

Commit

Permalink
small bugfix to show first display if default display was not found
Browse files Browse the repository at this point in the history
  • Loading branch information
adkinsrs committed Jan 22, 2024
1 parent acef04c commit 467ae5d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion www/js/classes/tilegrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class DatasetTile {
/**
* Generates the HTML representation of a tile.
* @returns {HTMLElement} The HTML element representing the tile.
*
*
* Note: Tile html template comes from /include/tile-grid/tile.html
*/
generateTileHTML() {
Expand Down Expand Up @@ -296,6 +296,14 @@ class DatasetTile {
if (!ownerDisplay) ownerDisplay = this.dataset.ownerDisplays.find((d) => d.id === displayId && d.plot_type === "epiviz");
}

// add console warning if default display id was not found in the user or owner display lists
if (!userDisplay && !ownerDisplay) {
console.warn(`Selected display config for dataset ${this.dataset.title} was not found. Will show first available.`);

// last chance... if still no display config (i.e default display was not found), then use the first display config
if (!userDisplay) userDisplay = this.dataset.userDisplays.find((d) => d.plotly_config.hasOwnProperty(filterKey));
if (!ownerDisplay) ownerDisplay = this.dataset.ownerDisplays.find((d) => d.plotly_config.hasOwnProperty(filterKey));
}

// if the display config was not found, then do not render
if (!userDisplay && !ownerDisplay) {
Expand Down

0 comments on commit 467ae5d

Please sign in to comment.