From ffad2db103dd3279db8ee62d152250f913d374e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Wed, 19 Feb 2025 12:28:38 +0100 Subject: [PATCH] fix regression in previous commit: consume PendingDispatch *before* reverting context --- src/Tenancy.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Tenancy.php b/src/Tenancy.php index 5ab6400d..f96c0a51 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -83,6 +83,10 @@ class Tenancy $this->initialize($tenant); $result = $callback($tenant); } finally { + if ($result instanceof PendingDispatch) { // #1277 + $result = null; + } + if ($originalTenant) { $this->initialize($originalTenant); } else { @@ -90,10 +94,6 @@ class Tenancy } } - if ($result instanceof PendingDispatch) { // #1277 - $result = null; - } - return $result; }