Skip to content

Commit

Permalink
fix stepIdOffset handling
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectronicBlueberry committed Dec 19, 2024
1 parent a7afb68 commit 4fac7da
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions client/src/components/Workflow/Editor/modules/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,15 @@ export async function fromSimple(
// If workflow being copied into another, wipe UUID and let
// Galaxy assign new ones.
if (options?.reassignIds ?? appendData) {
const stepIdOffset = stepStore.getStepIndex + 1;
const highestStepId = stepStore.getStepIndex;

Object.values(data.steps).forEach((step) => {
const stepArray = Object.values(data.steps);
const stepIds = Object.keys(data.steps).map((id) => parseInt(id));
const lowestStepId = Math.min(...stepIds);

const stepIdOffset = highestStepId - lowestStepId + 1;

stepArray.forEach((step) => {
delete step.uuid;
if (!step.position) {
// Should only happen for manually authored editor content,
Expand Down

0 comments on commit 4fac7da

Please sign in to comment.