Skip to content

Commit c02b4e8

Browse files
authored
fix: recheck security state and action, if action prop changed (#18)
1 parent f6895d0 commit c02b4e8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/ui/ActionContainer.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,17 @@ export const ActionContainer = ({
279279
: 'blocked',
280280
});
281281

282+
// in case, where action or websiteUrl changes, we need to reset the action state
283+
useEffect(() => {
284+
if (action === initialAction || action.isChained) {
285+
return;
286+
}
287+
288+
setAction(initialAction);
289+
setActionState(getOverallActionState(initialAction, websiteUrl));
290+
dispatch({ type: ExecutionType.RESET });
291+
}, [action, initialAction, websiteUrl]);
292+
282293
useEffect(() => {
283294
callbacks?.onActionMount?.(
284295
action,

0 commit comments

Comments
 (0)