Clear tournament cache on sub post change to keep the number in tab in sync

This commit is contained in:
Kalle
2024-10-20 09:30:10 +03:00
parent c05a0fe0d9
commit 76e7570f5b
2 changed files with 12 additions and 2 deletions

View File

@@ -17,7 +17,10 @@ import { TrashIcon } from "~/components/icons/Trash";
import { useUser } from "~/features/auth/core/user";
import { requireUser } from "~/features/auth/core/user.server";
import { tournamentIdFromParams } from "~/features/tournament";
import { tournamentFromDB } from "~/features/tournament-bracket/core/Tournament.server";
import {
clearTournamentDataCache,
tournamentFromDB,
} from "~/features/tournament-bracket/core/Tournament.server";
import type { MainWeaponId } from "~/modules/in-game-lists";
import {
type SendouRouteHandle,
@@ -65,6 +68,8 @@ export const action: ActionFunction = async ({ params, request }) => {
userId: user.id,
});
clearTournamentDataCache(tournamentId);
throw redirect(tournamentSubsPage(tournamentId));
};

View File

@@ -18,7 +18,10 @@ import { TrashIcon } from "~/components/icons/Trash";
import { useUser } from "~/features/auth/core/user";
import { getUser, requireUser } from "~/features/auth/core/user.server";
import { tournamentIdFromParams } from "~/features/tournament";
import { tournamentFromDB } from "~/features/tournament-bracket/core/Tournament.server";
import {
clearTournamentDataCache,
tournamentFromDB,
} from "~/features/tournament-bracket/core/Tournament.server";
import { useTournament } from "~/features/tournament/routes/to.$id";
import { parseRequestPayload, validate } from "~/utils/remix.server";
import { assertUnreachable } from "~/utils/types";
@@ -52,6 +55,8 @@ export const action: ActionFunction = async ({ request, params }) => {
userId: data.userId,
});
clearTournamentDataCache(tournamentId);
return null;
};