Skip to content

Commit

Permalink
fix(tasks): fix context merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 3, 2021
1 parent 405b0ce commit 2ff3f85
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tasks/transform/context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Task, Context } from '../../definitions';
import { run } from '../../utils/run';
import { UnaryFn, Empty } from 'type-core';
import { shallow } from 'merge-strategies';

/**
* Modifies a task's context with a given `context`.
Expand All @@ -19,6 +20,6 @@ export function context(
): Task.Async {
const fn = typeof context === 'function' ? context : () => context;
return async (context: Context): Promise<void> => {
await run(task, { ...context, ...fn(context) });
await run(task, shallow(context, fn(context) || undefined));
};
}

0 comments on commit 2ff3f85

Please sign in to comment.