diff --git a/packages/support/src/Components/ViewComponent.php b/packages/support/src/Components/ViewComponent.php index 5278d2242e..b45340c862 100644 --- a/packages/support/src/Components/ViewComponent.php +++ b/packages/support/src/Components/ViewComponent.php @@ -146,15 +146,15 @@ abstract class ViewComponent extends Component implements Htmlable public function render(): View { - return $this->viewInstance ??= view( - $this->getView(), - [ - 'attributes' => new ComponentAttributeBag, - ...$this->extractPublicMethods(), - ...(isset($this->viewIdentifier) ? [$this->viewIdentifier => $this] : []), - ...$this->getExtraViewData(), - ...$this->getViewData(), - ], - ); + $this->viewInstance ??= view($this->getView(), [ + ...$this->extractPublicMethods(), + ...(isset($this->viewIdentifier) ? [$this->viewIdentifier => $this] : []), + ]); + + return $this->viewInstance->with([ + 'attributes' => new ComponentAttributeBag, + ...$this->getExtraViewData(), + ...$this->getViewData(), + ]); } }