Set LatestTeam when switching in tenant menu
I see in the docs how to set the latest team and use the
HasDefaultTenant
contract, but don't see any way to tap into the tenant select menu to set the latest team when the user changes that. What's the best way to accomplish that?Solution:Jump to solution
I figured out a way to not use custom navigation and everything seems to be working fine now. Seems like this shouldn't break the tenant switching menu though.
4 Replies
Seems like I could possibly listen for the TenantSet event..
I'm not sure of the issue I'm running into actually. I removed the
HasDefaultTenant
contract, and I'm still unable to change tenants. It just refreshes and always goes back to the same tenant. I thought it was because of the default tenant thing I was trying to add and maybe because the database field wasn't getting updated with the latest_team_id
, but even after removing it and nulling out that field, I'm still unable to change tenants for some reason.
Anyone have any idea why the tenant switching menu wouldn't work? You can select a team, but it always goes back to the same one.
I figured out if I comment out my custom navigation, it starts working...I don't get that.
Solution
I figured out a way to not use custom navigation and everything seems to be working fine now. Seems like this shouldn't break the tenant switching menu though.
Hey Jon.
How did you end up solving this? I have the exact same problem..
Create a listener for the
TenantSet
event from Filament. Inside of that listener, update the current team id of the user.