From cc1c9f9688dcc06a97b7fceb6e2af91995a361d8 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 1 Jun 2024 14:46:47 +0300 Subject: [PATCH] Don't load tournament main loader when navigating to match page --- app/features/tournament/routes/to.$id.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/features/tournament/routes/to.$id.tsx b/app/features/tournament/routes/to.$id.tsx index 1a48ce0fb..b21dc95fa 100644 --- a/app/features/tournament/routes/to.$id.tsx +++ b/app/features/tournament/routes/to.$id.tsx @@ -5,6 +5,7 @@ import type { } from "@remix-run/node"; import { Outlet, + type ShouldRevalidateFunction, useLoaderData, useLocation, useOutletContext, @@ -36,6 +37,14 @@ import "../tournament.css"; import "~/styles/maps.css"; import "~/styles/calendar-event.css"; +export const shouldRevalidate: ShouldRevalidateFunction = (args) => { + const navigatedToMatchPage = typeof args.nextParams["mid"] === "string"; + + if (navigatedToMatchPage) return false; + + return args.defaultShouldRevalidate; +}; + export const meta: MetaFunction = (args) => { const data = args.data as SerializeFrom;