Multi tenancy and CustomEditProfile

I have a CustomEditProfile Page
->userMenuItems([
     'profile' => MenuItem::make()->url(fn (): string => EditProfile::getUrl()),
])



When I go to create new tenant which will go to "/new route . I will get error
Missing required parameter for [Route: filament.admin.pages.profile] [URI: {tenant}/profile] [Missing parameter: tenant].


Right now I found a solution do this
->userMenuItems([
                'profile' => MenuItem::make()->url(fn (): string => EditProfile::getUrl())->hidden(fn (): bool => request()->routeIs('filament.admin.tenant.registration')),


But I think there is a better way , anyone can help me ?
Was this page helpful?