Skip to content

Commit eaa5ee1

Browse files
authored
fix: execute deferred functions lazily
1 parent 6f98d4f commit eaa5ee1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/commandkit/src/context/async-context.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,13 @@ export function makeContextAwareFunction<
4343
} finally {
4444
if (typeof finalizer === 'function') {
4545
// execute the finalizer function
46-
try {
47-
await finalizer(...args);
48-
} catch {
49-
// no-op
50-
}
46+
setImmediate(async () => {
47+
try {
48+
await finalizer(...args);
49+
} catch {
50+
// no-op
51+
}
52+
});
5153
}
5254
}
5355
});

0 commit comments

Comments
 (0)