This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { RSCPolling } from "./rsc-polling"; | |
export const DataFetcher = async () => { | |
const { status, data } = await getData(); | |
if (status === "processing") { | |
return <RSCPolling interval={1000} />; | |
} | |
return <DataViewer data={data} />; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NextRouter } from "next/router"; | |
declare module "next/router" { | |
export type Locale = "en" | "nl" | "de"; | |
export function useRouter(): Omit<NextRouter, "locale" | "locales"> & { | |
locale: Locale; | |
locales: Locale[]; | |
}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { encodeDelimitedArray, decodeDelimitedArray } from "serialize-query-params"; | |
/** Uses a comma to delimit entries. e.g. ['a', 'b'] => qp?=a,b */ | |
const CommaArrayParam = { | |
encode: array => { | |
if (!array || array.length === 0) return undefined; | |
return encodeDelimitedArray(array, ","); | |
}, | |
decode: arrayStr => { | |
if (!arrayStr) return undefined; |