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
27 lines
824 B
Plaintext
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,
|
|
}
|
|
}
|