Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 332x 6294x 332x 180x 180x | import {
DEFAULT_LIMIT,
fallback,
limitSchema as rawLimitSchema,
} from "~app/utils/validation";
import type { RouterContext } from "~web/pages/__root";
export const LIMIT_STORE_NAME = "receipt_limit";
export const limitSchema = rawLimitSchema.or(fallback(() => undefined));
export const withDefaultLimit = (
currentLimit: number | undefined,
ctx: RouterContext,
) => {
const defaultLimit = ctx.initialValues[LIMIT_STORE_NAME];
return typeof currentLimit === "number"
? currentLimit
: defaultLimit || DEFAULT_LIMIT;
};
|