Skip to content

Commit

Permalink
Reduce duplication
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Mar 7, 2024
1 parent 91c6bcd commit 05b4c5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
17 changes: 7 additions & 10 deletions app/routes/jobs.$id.tools.reclustfcc.$module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,26 @@ export const loader = async ({ params, request }: LoaderFunctionArgs) => {
request.url,
hasInteractiveVersion
);
const defaultValues = await getParams({
const info = {
jobid,
moduleIndex,
isInteractive: showInteractiveVersion,
bartenderToken,
moduleIndexPadding,
}
const defaultValues = await getParams({
moduleIndex,
...info,
});
const clusters = await getClusters({
jobid,
moduleIndex,
isInteractive: showInteractiveVersion,
bartenderToken,
moduleIndexPadding,
...info,
});
let caprievalData;
if (showInteractiveVersion) {
const { scatterSelection, boxSelection } = getPlotSelection(request.url);
caprievalData = await getCaprievalData({
jobid,
module: moduleIndex,
isInteractive: showInteractiveVersion,
bartenderToken,
moduleIndexPadding,
...info,
scatterSelection,
boxSelection,
moduleName: "clustfcc",
Expand Down
17 changes: 7 additions & 10 deletions app/routes/jobs.$id.tools.reclustrmsd.$module.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,29 +57,26 @@ export const loader = async ({ params, request }: LoaderFunctionArgs) => {
request.url,
hasInteractiveVersion
);
const defaultValues = await getParams({
const info = {
jobid: jobId,
moduleIndex,
isInteractive: showInteractiveVersion,
bartenderToken,
moduleIndexPadding,
}
const defaultValues = await getParams({
moduleIndex,
...info,
});
const clusters = await getClusters({
jobid: jobId,
moduleIndex,
isInteractive: showInteractiveVersion,
bartenderToken,
moduleIndexPadding,
...info,
});
let caprievalData;
if (showInteractiveVersion) {
const { scatterSelection, boxSelection } = getPlotSelection(request.url);
caprievalData = await getCaprievalData({
jobid: jobId,
module: moduleIndex,
isInteractive: showInteractiveVersion,
bartenderToken,
moduleIndexPadding,
...info,
scatterSelection,
boxSelection,
moduleName: "clustrmsd",
Expand Down

0 comments on commit 05b4c5e

Please sign in to comment.