Remix - Advanced Patterns
Identify the bug in this Remix loader for multi-tenant data fetching:
export async function loader({ request }) {
const url = new URL(request.url);
const tenant = url.pathname.split('/')[2];
if (!tenant) throw new Error('Tenant missing');
return { tenant };
}