Skip to content

Commit

Permalink
Better error handling for viewer container
Browse files Browse the repository at this point in the history
  • Loading branch information
liambai committed Oct 28, 2024
1 parent b8c38a9 commit 4e9583d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion viz/src/components/CustomStructureViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ const CustomStructureViewer = ({
const renderViewer = (blobUrl: string) => {
// @ts-expect-error: PDBeMolstarPlugin is not typed
const viewerInstance = new PDBeMolstarPlugin();
const viewerContainer = document.getElementById(viewerId);
if (!viewerContainer) {
return;
}
const options = {
customData: {
url: blobUrl,
Expand All @@ -59,7 +63,7 @@ const CustomStructureViewer = ({
sequencePanel: true,
landscape: true,
};
const viewerContainer = document.getElementById(viewerId);

viewerInstance.render(viewerContainer, options);

viewerInstance.events.loadComplete.subscribe(() => {
Expand Down

0 comments on commit 4e9583d

Please sign in to comment.