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
| export interface ScheduleHandlerContext<E = Env> { | |
| /** | |
| * The scheduled event controller providing details about the cron trigger. | |
| */ | |
| controller: ScheduledController; | |
| /** | |
| * The environment bindings available to the worker. | |
| */ | |
| env: E; | |
| /** |
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
| // src/routes/search/useDebouncedSearchParam.ts | |
| import { useEffect, useMemo, useRef, useState } from 'react' | |
| import { useDebouncedValue } from '@tanstack/react-pacer' // React adapter re-exports | |
| // Alternative import also works in examples: '@tanstack/react-pacer/debouncer'. | |
| // See Pacer React adapter docs. :contentReference[oaicite:5]{index=5} | |
| type RouteSearchFrom<RouteApi> = RouteApi extends { types: { fullSearchSchema: infer TSchema } } | |
| ? TSchema extends Record<string, unknown> | |
| ? TSchema | |
| : Record<string, unknown> |
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
| // Turn all HTML <a> elements into client side router links, no special framework-specific <Link> component necessary! | |
| // Example using the Next.js App Router. | |
| import { useRouter } from 'next/navigation'; | |
| import { useEffect } from 'react'; | |
| function useLinkHandler() { | |
| let router = useRouter(); | |
| useEffect(() => { | |
| let onClick = e => { |
This middleware does a few interesting things:
- Ensures a
urlshape in the zustand store, where we'll store URL information. - Assumes we will be storing our
urlstate slice in the?statesearch parameter after it has been stringified and base 64 encoded. - On creation, decodes stores state from the
?statesearch parameter into theurlslice of our store. - After each state update, updates the
?statesearch parameter with the newurlstate slice. - Sets up an event listener that listens for
popstateand re-decodes the state from the URL into our store.
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
| name: PlanetScale Migration | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| paths: | |
| - packages/shared/adapters/prisma/schema.prisma | |
| env: | |
| PLANETSCALE_ORG: flightcontrol | |
| PLANETSCALE_DB: fc-production |
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 invariant from "tiny-invariant"; | |
| class AmalgoBox extends HTMLElement { | |
| get input() { | |
| return this.querySelector("input") as HTMLInputElement; | |
| } | |
| get button() { | |
| return this.querySelector("button") as HTMLButtonElement; | |
| } |
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 { withAuthUserTokenSSR, AuthAction, type AuthUser } from "next-firebase-auth"; | |
| import { NextApiRequest, NextApiResponse } from "next"; | |
| const checkServerSideAuth = | |
| typeof window !== "undefined" | |
| ? () => {} // "withAuthUserTokenSSR" can only be called server-side. | |
| : withAuthUserTokenSSR({ | |
| whenAuthed: AuthAction.RENDER, | |
| whenUnauthed: AuthAction.REDIRECT_TO_LOGIN, | |
| authPageURL: "401", |
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 * as React from "react" | |
| import { Model } from "@croquet/croquet" | |
| import { CroquetContext } from "@croquet/react" | |
| /** | |
| * A callback that publishes the returned data to the current view's model. | |
| * @param eventName The name of the event to be published. | |
| * @param fn A function that returns the data to be published. | |
| * @param deps (optional) An array of dependencies for the callback. | |
| */ |
NewerOlder