Hi,
I’m working on a Remix embedded app, and I have an issue with route redirection. When I try to change the route using the left navigation menu, my app first reloads to the previous page and then, after one second, redirects to
the new page. I’ve used loaders in the routes—maybe that’s causing the issue. What can I do to fix this? Am I doing something wrong?
app._index.tsx
export async function loader({ request }) {
const { session, billing, cors } = await authenticate.admin(request);
const billingCheck = await billing.check({
plans: [PlanNames.Expert, PlanNames.Professional],
});
const subscription = billingCheck.appSubscriptions[0];
const initialData = await getInitialData(session.id);
return cors(
json({
...initialData,
session,
subscription,
developmentMode: developmentMode,
}),
);
}
app.tsx
export default function App() {
const { apiKey } = useLoaderData<LoaderResponse>();
const { t } = useTranslation();
return (
<AppProvider apiKey={apiKey}>
<ui-nav-menu>
<Link to="/app" rel="home">
{t("home")}
</Link>
<Link to="/app/issueList">{t("issueList")}</Link>
<Link to="/app/settings">{t("settings")}</Link>
<Link to="/app/plans">{t("plans")}</Link>
</ui-nav-menu>
<Outlet />
</AppProvider>
);
}