fix: Prevent "action loops" (#1978)

- Closes: #1967
- Closes: #1969
This commit is contained in:
Dermot Duffy
2025-03-22 18:39:36 -07:00
committed by GitHub
parent d6225fefda
commit 8512df1720
6 changed files with 75 additions and 15 deletions
@@ -2,11 +2,11 @@ import merge from 'lodash-es/merge';
import { Action, TargetedActionContext } from '../types';
import { ActionContext } from 'action';
export const stopInProgressForThisTarget = (
export const stopInProgressForThisTarget = async (
targetID: string,
context?: TargetedActionContext,
): void => {
context?.[targetID]?.inProgressAction?.stop();
): Promise<void> => {
await context?.[targetID]?.inProgressAction?.stop();
};
export const setInProgressForThisTarget = (
@@ -14,7 +14,7 @@ export const setInProgressForThisTarget = (
context: ActionContext,
contextKey: keyof ActionContext,
action: Action,
) => {
): void => {
merge(context, {
[contextKey]: {
[targetID]: {