Skip to content

Commit

Permalink
Merge pull request #8 from SyLi9527/master
Browse files Browse the repository at this point in the history
fix "Invalid data cell" issue
  • Loading branch information
samirelanduk authored May 12, 2023
2 parents c906702 + e3f51e5 commit b5f5a2d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Molstar.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useRef } from "react";
import React, { useEffect, useRef, useState } from "react";
import PropTypes from "prop-types";
import { DefaultPluginSpec } from "molstar/lib/mol-plugin/spec";
import { DefaultPluginUISpec } from "molstar/lib/mol-plugin-ui/spec";
Expand All @@ -14,7 +14,7 @@ const Molstar = props => {
const parentRef = useRef(null);
const canvasRef = useRef(null);
const plugin = useRef(null);

const [initialized, setInitialized] = useState(false);

useEffect(() => {
(async () => {
Expand All @@ -39,13 +39,17 @@ const Molstar = props => {
} } } });
}
await loadStructure(pdbId, url, file, plugin.current);
setInitialized(true);
})();
return () => plugin.current = null;
}, [])


useEffect(() => {
loadStructure(pdbId, url, file, plugin.current);
if (!initialized) return;
(async() => {
await loadStructure(pdbId, url, file, plugin.current);
})();
}, [pdbId, url, file])


Expand Down

0 comments on commit b5f5a2d

Please sign in to comment.