Skip to content

Commit 8901c7b

Browse files
fix(plugin-multi-tenant): fix infinite sync tenant network calls (#14604)
Fixes an issue where selecting a tenant, logging out and back in would cause the network to be cluttered with sync tenant calls. This happened because the initialValue (initialCookie) for the tenant does not clear when the user logs out. This PR calls router.refresh on log out so the initialValue is reset after the cookie is deleted from logging out.
1 parent 36f3cad commit 8901c7b

File tree

1 file changed

+2
-1
lines changed
  • packages/plugin-multi-tenant/src/providers/TenantSelectionProvider

1 file changed

+2
-1
lines changed

packages/plugin-multi-tenant/src/providers/TenantSelectionProvider/index.client.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,11 @@ export const TenantSelectionProviderClient = ({
224224
if (tenantOptions.length > 0) {
225225
setTenantOptions([])
226226
}
227+
router.refresh()
227228
}
228229
prevUserID.current = userID
229230
}
230-
}, [userID, userChanged, syncTenants, tenantOptions, initialValue])
231+
}, [userID, userChanged, syncTenants, tenantOptions, initialValue, router])
231232

232233
/**
233234
* If there is no initial value, clear the tenant and refresh the router.

0 commit comments

Comments
 (0)