From 67e29cfaec6516a33038ef15e86f134c14f94a55 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Tue, 16 Sep 2025 16:50:03 +0100 Subject: [PATCH 1/4] 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(); From 5719f62a799e61dd5d83c9c0f25834cc92f21dcc Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Tue, 16 Sep 2025 17:03:03 +0100 Subject: [PATCH 2/4] Revert "fix: Merge action arguments without overwriting" This reverts commit 67e29cfaec6516a33038ef15e86f134c14f94a55. --- packages/actions/src/Concerns/HasArguments.php | 17 +++++------------ .../src/Concerns/InteractsWithActions.php | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/packages/actions/src/Concerns/HasArguments.php b/packages/actions/src/Concerns/HasArguments.php index 8e022558e6..0b8d6152a2 100644 --- a/packages/actions/src/Concerns/HasArguments.php +++ b/packages/actions/src/Concerns/HasArguments.php @@ -29,19 +29,12 @@ trait HasArguments /** * @param array $arguments */ - public function mergeArguments(array $arguments, bool $shouldOverwriteExistingArguments = true): static + public function mergeArguments(array $arguments): static { - if ($shouldOverwriteExistingArguments) { - $this->arguments = [ - ...$this->arguments ?? [], - ...$arguments, - ]; - } else { - $this->arguments = [ - ...$arguments, - ...$this->arguments ?? [], - ]; - } + $this->arguments = [ + ...$this->arguments ?? [], + ...$arguments, + ]; return $this; } diff --git a/packages/actions/src/Concerns/InteractsWithActions.php b/packages/actions/src/Concerns/InteractsWithActions.php index bbcc2a3678..bf5e5cace8 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'] ?? [], shouldOverwriteExistingArguments: false); + $resolvedAction->mergeArguments($action['arguments'] ?? []); $resolvedAction->nestingIndex($actionNestingIndex); $resolvedAction->boot(); From 246f547c524e2779288636cf9a7d6e0a23632418 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Tue, 16 Sep 2025 17:03:31 +0100 Subject: [PATCH 3/4] fix --- packages/actions/src/Concerns/InteractsWithActions.php | 1 - packages/actions/src/Testing/TestsActions.php | 8 ++++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/actions/src/Concerns/InteractsWithActions.php b/packages/actions/src/Concerns/InteractsWithActions.php index bf5e5cace8..d09ac6590d 100644 --- a/packages/actions/src/Concerns/InteractsWithActions.php +++ b/packages/actions/src/Concerns/InteractsWithActions.php @@ -495,7 +495,6 @@ trait InteractsWithActions continue; } - $resolvedAction->mergeArguments($action['arguments'] ?? []); $resolvedAction->nestingIndex($actionNestingIndex); $resolvedAction->boot(); diff --git a/packages/actions/src/Testing/TestsActions.php b/packages/actions/src/Testing/TestsActions.php index 7967b0c789..0952e5c599 100644 --- a/packages/actions/src/Testing/TestsActions.php +++ b/packages/actions/src/Testing/TestsActions.php @@ -145,6 +145,10 @@ class TestsActions ...$actions, ]); + if ($action && filled($arguments = Arr::last($actions)['arguments'])) { + $action->mergeArguments($arguments); + } + $livewireClass = $this->instance()::class; $prettyName = implode(' > ', Arr::pluck($actions, 'name')); @@ -184,6 +188,10 @@ class TestsActions return $this; } + if ($action && filled($arguments = Arr::last($actions)['arguments'])) { + $action->mergeArguments($arguments); + } + $livewireClass = $this->instance()::class; $prettyName = implode(' > ', Arr::pluck($actions, 'name')); From b2c14a5ab357ce4bb0eab671529d77b78c0870bd Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Tue, 16 Sep 2025 17:07:02 +0100 Subject: [PATCH 4/4] Update TestsActions.php --- packages/actions/src/Testing/TestsActions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/actions/src/Testing/TestsActions.php b/packages/actions/src/Testing/TestsActions.php index 0952e5c599..ed0ee03f61 100644 --- a/packages/actions/src/Testing/TestsActions.php +++ b/packages/actions/src/Testing/TestsActions.php @@ -145,7 +145,7 @@ class TestsActions ...$actions, ]); - if ($action && filled($arguments = Arr::last($actions)['arguments'])) { + if ($action && filled($arguments = Arr::last($actions)['arguments'] ?? [])) { $action->mergeArguments($arguments); } @@ -188,7 +188,7 @@ class TestsActions return $this; } - if ($action && filled($arguments = Arr::last($actions)['arguments'])) { + if ($action && filled($arguments = Arr::last($actions)['arguments'] ?? [])) { $action->mergeArguments($arguments); }