Files
SnowLuma/.pnpm-store/v11/files/76/11a9f8af97d0b2b86a30f218622dcd37aff21bf6b66f6626e2685f8fbea5f44895ead9461596b26b23df719e8b30442a9a26858b8d74633324f0ad94021a6c
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

27 lines
824 B
Plaintext

import { batch, createAtom } from '@tanstack/react-store'
import {
createNonReactiveMutableStore,
createNonReactiveReadonlyStore,
} from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import type { Readable } from '@tanstack/react-store'
import type { GetStoreConfig } from '@tanstack/router-core'
declare module '@tanstack/router-core' {
export interface RouterReadableStore<TValue> extends Readable<TValue> {}
}
export const getStoreFactory: GetStoreConfig = (opts) => {
if (isServer ?? opts.isServer) {
return {
createMutableStore: createNonReactiveMutableStore,
createReadonlyStore: createNonReactiveReadonlyStore,
batch: (fn) => fn(),
}
}
return {
createMutableStore: createAtom,
createReadonlyStore: createAtom,
batch: batch,
}
}