mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-05-09 04:02:40 -05:00
Optimize suggestions loader call amounts
This commit is contained in:
parent
118d89496a
commit
96471cc47f
|
|
@ -4,7 +4,13 @@ import type {
|
|||
MetaFunction,
|
||||
} from "@remix-run/node";
|
||||
import { json } from "@remix-run/node";
|
||||
import { Link, Outlet, useLoaderData, useSearchParams } from "@remix-run/react";
|
||||
import {
|
||||
Link,
|
||||
Outlet,
|
||||
ShouldReloadFunction,
|
||||
useLoaderData,
|
||||
useSearchParams,
|
||||
} from "@remix-run/react";
|
||||
import clsx from "clsx";
|
||||
import invariant from "tiny-invariant";
|
||||
import { z } from "zod";
|
||||
|
|
@ -114,6 +120,11 @@ export interface PlusSuggestionsLoaderData {
|
|||
suggestedForTiers: number[];
|
||||
}
|
||||
|
||||
export const unstable_shouldReload: ShouldReloadFunction = ({ submission }) => {
|
||||
// only reload if form submission not when user changes tabs
|
||||
return Boolean(submission);
|
||||
};
|
||||
|
||||
export const loader: LoaderFunction = async ({ request }) => {
|
||||
const user = await getUser(request);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user