Skip to content

Commit

Permalink
Couple more simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Dec 18, 2024
1 parent 3df29f8 commit 258cf5c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
15 changes: 6 additions & 9 deletions lib/src/components/GenericGeneSeqPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ const GenericGeneSeqPanel = observer(function ({
}) {
const [result, setResult] = useState<Feature[]>();
const [error, setError] = useState<unknown>();
const [{ sequenceFeatureDetails }] = useState(() =>
Model.create({
const [{ sequenceFeatureDetails }] = useState(() => {
const model = Model.create({
sequenceFeatureDetails: {},
}),
);
});
model.sequenceFeatureDetails.setUpDownBp(500);
return model;
});

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-floating-promises
Expand Down Expand Up @@ -100,12 +102,7 @@ const GenericGeneSeqPanel = observer(function ({
{sequenceFeatureDetails.feature ? (
<GenericSeqPanel
refseq={refseq}
start={start}
end={end}
fastaurl={fastaurl}
gene={gene}
urltemplate={urltemplate}
nclistbaseurl={nclistbaseurl}
model={sequenceFeatureDetails}
/>
) : null}
Expand Down
23 changes: 1 addition & 22 deletions lib/src/components/GenericSeqPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,12 @@ import { SequenceFeatureDetailsModel } from "@jbrowse/core/BaseFeatureWidget/Seq
type Bundle = Awaited<ReturnType<typeof assembleBundle>>;

const GenericSeqPanel = observer(function ({
nclistbaseurl,
fastaurl,
refseq,
start,
end,
gene,
urltemplate,
model,
}: {
nclistbaseurl: string;
fastaurl: string;
refseq: string;
start: number;
end: number;
gene: string;
urltemplate: string;
model: SequenceFeatureDetailsModel;
}) {
const [result, setResult] = useState<Bundle>();
Expand Down Expand Up @@ -55,18 +45,7 @@ const GenericSeqPanel = observer(function ({
setError(e);
}
})();
}, [
refseq,
feature,
upDownBp,
intronBp,
gene,
start,
end,
fastaurl,
urltemplate,
nclistbaseurl,
]);
}, [intronBp, fastaurl, refseq, upDownBp, feature]);

if (error) {
return <div style={{ color: "red" }}>{`${error}`}</div>;
Expand Down

0 comments on commit 258cf5c

Please sign in to comment.