Skip to content

Commit

Permalink
React to pdb ID/URL prop changing
Browse files Browse the repository at this point in the history
  • Loading branch information
samirelanduk committed Jan 28, 2022
1 parent 8cfd6cb commit 332246d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Molstar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ const Molstar = props => {
return () => plugin.current = null;
}, [])

useEffect(async () => {
await loadStructure(pdbId, url, plugin.current);
}, [pdbId, url])

const loadStructure = async (pdbId, url, plugin) => {
plugin.clear();
const structureUrl = url ? url : pdbId ? `https://files.rcsb.org/view/${pdbId}.cif` : null;
if (!structureUrl) return;
const data = await plugin.builders.data.download(
Expand Down

0 comments on commit 332246d

Please sign in to comment.