From 67e29cfaec6516a33038ef15e86f134c14f94a55 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Tue, 16 Sep 2025 16:50:03 +0100 Subject: [PATCH] fix: Merge action arguments without overwriting --- packages/actions/src/Concerns/HasArguments.php | 17 ++++++++++++----- .../src/Concerns/InteractsWithActions.php | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/actions/src/Concerns/HasArguments.php b/packages/actions/src/Concerns/HasArguments.php index 0b8d6152a2..8e022558e6 100644 --- a/packages/actions/src/Concerns/HasArguments.php +++ b/packages/actions/src/Concerns/HasArguments.php @@ -29,12 +29,19 @@ trait HasArguments /** * @param array $arguments */ - public function mergeArguments(array $arguments): static + public function mergeArguments(array $arguments, bool $shouldOverwriteExistingArguments = true): static { - $this->arguments = [ - ...$this->arguments ?? [], - ...$arguments, - ]; + if ($shouldOverwriteExistingArguments) { + $this->arguments = [ + ...$this->arguments ?? [], + ...$arguments, + ]; + } else { + $this->arguments = [ + ...$arguments, + ...$this->arguments ?? [], + ]; + } return $this; } diff --git a/packages/actions/src/Concerns/InteractsWithActions.php b/packages/actions/src/Concerns/InteractsWithActions.php index bf5e5cace8..bbcc2a3678 100644 --- a/packages/actions/src/Concerns/InteractsWithActions.php +++ b/packages/actions/src/Concerns/InteractsWithActions.php @@ -495,7 +495,7 @@ trait InteractsWithActions continue; } - $resolvedAction->mergeArguments($action['arguments'] ?? []); + $resolvedAction->mergeArguments($action['arguments'] ?? [], shouldOverwriteExistingArguments: false); $resolvedAction->nestingIndex($actionNestingIndex); $resolvedAction->boot();