Skip to content

Commit 99ad6a6

Browse files
authored
Fix compound record runtime bugs (#1670)
* Fix ChemDoodle import for compound page * null-safe module.startsWith in DatasetGraph.tsx
1 parent 0b38115 commit 99ad6a6

4 files changed

Lines changed: 10 additions & 3 deletions

File tree

packages/libs/web-common/src/components/DatasetGraph.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface RecordTableProps {
3535
interface RowData {
3636
source_id: string;
3737
assay_type: string;
38-
module: string;
38+
module: string | null;
3939
paralog_number: number;
4040
graph_ids: string;
4141
dataset_id: string;
@@ -340,7 +340,7 @@ const DatasetGraph: React.FC<DatasetGraphProps> = ({
340340
const specialImgUrl =
341341
dataTable && dataTable.record.attributes.specialJbrowseUrl;
342342

343-
const isUserDataset = module.startsWith('UserDatasets');
343+
const isUserDataset = module?.startsWith('UserDatasets') ?? false;
344344

345345
const dataset_link = makeDatasetUrl(rowData, isUserDataset);
346346
const tutorial_link = makeTutorialUrl();

packages/sites/genomics-site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"file-loader": "^3.0.1",
7070
"html-webpack-plugin": "^4.5.2",
7171
"ify-loader": "^1.1.0",
72+
"imports-loader": "^1.1.1",
7273
"jquery": "1.9.1",
7374
"js-cookie": "^2.2.0",
7475
"mini-css-extract-plugin": "^2.7.6",

packages/sites/genomics-site/webapp/wdkCustomization/js/client/components/common/Compound.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ export function loadChemDoodleWeb() {
1414
return new Promise(function (resolve, reject) {
1515
try {
1616
require.ensure([], function (require) {
17-
require('!!script-loader!site/js/ChemDoodleWeb');
17+
// ChemDoodleWeb.js is a UMD module. When loaded via script-loader,
18+
// webpack's module-scope `exports` leaks into the eval scope and
19+
// the UMD wrapper picks the CommonJS branch, then throws on the
20+
// undefined `module`. Shadow both so the UMD falls through to the
21+
// browser-global branch that actually registers readMOL et al.
22+
require('!!script-loader!imports-loader?additionalCode=var%20exports%3Dundefined%3Bvar%20module%3Dundefined%3B!site/js/ChemDoodleWeb');
1823
resolve(ChemDoodle);
1924
});
2025
} catch (err) {

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8805,6 +8805,7 @@ __metadata:
88058805
file-loader: "npm:^3.0.1"
88068806
html-webpack-plugin: "npm:^4.5.2"
88078807
ify-loader: "npm:^1.1.0"
8808+
imports-loader: "npm:^1.1.1"
88088809
jquery: "npm:1.9.1"
88098810
js-cookie: "npm:^2.2.0"
88108811
mini-css-extract-plugin: "npm:^2.7.6"

0 commit comments

Comments
 (0)