Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/six-peas-make.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@workflow/core": patch
---

Use globalThis-backed Map for step function registry to prevent module duplication from splitting the registry in Turbopack dev mode
11 changes: 10 additions & 1 deletion packages/core/src/private.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ export type StepFunction<
stepId?: string;
};

const registeredSteps = new Map<string, StepFunction>();
const RegisteredStepsKey = Symbol.for('@workflow/core//registeredSteps');

const globalSymbols: typeof globalThis & {
[RegisteredStepsKey]?: Map<string, StepFunction>;
} = globalThis;

const registeredSteps = (globalSymbols[RegisteredStepsKey] ??= new Map<
string,
StepFunction
>());

function getStepIdAliasCandidates(stepId: string): string[] {
const parts = stepId.split('//');
Expand Down
Loading