From ba555b551858848ff8fa4c65a4673437f31f4255 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Mon, 23 Sep 2024 11:50:22 +0200 Subject: [PATCH] chore: Remove unused internals test We're no longer using internals in the v2 branch. --- .../src/app/(pages)/_landing/demo.client.tsx | 19 +++++++++++++----- packages/e2e/cypress/e2e/internals.cy.js | 9 --------- packages/e2e/src/app/app/internals/page.tsx | 20 ------------------- 3 files changed, 14 insertions(+), 34 deletions(-) delete mode 100644 packages/e2e/cypress/e2e/internals.cy.js delete mode 100644 packages/e2e/src/app/app/internals/page.tsx diff --git a/packages/docs/src/app/(pages)/_landing/demo.client.tsx b/packages/docs/src/app/(pages)/_landing/demo.client.tsx index ad9a1c2d..26143464 100644 --- a/packages/docs/src/app/(pages)/_landing/demo.client.tsx +++ b/packages/docs/src/app/(pages)/_landing/demo.client.tsx @@ -1,13 +1,22 @@ 'use client' -import { parseAsInteger, useQueryState } from 'nuqs' +import { useQueryState } from 'nuqs' +import { z } from 'zod' export function Demo() { const [hello, setHello] = useQueryState('hello', { defaultValue: '' }) - const [count, setCount] = useQueryState( - 'count', - parseAsInteger.withDefault(0) - ) + const [count, setCount] = useQueryState('count', { + parse: z.coerce + .number() + .int() + .default(0) + .catch(({ input = 0 }) => { + if (typeof input !== 'number') return 0 // Somehow it can be a string + if (Number.isNaN(input)) return 0 + return Math.floor(input) + }).parse, + defaultValue: 0 + }) return ( <>