@@ -11,11 +11,18 @@
|
|||||||
// Import Routes
|
// Import Routes
|
||||||
|
|
||||||
import { Route as rootRoute } from './routes/__root'
|
import { Route as rootRoute } from './routes/__root'
|
||||||
|
import { Route as TeardownImport } from './routes/teardown'
|
||||||
import { Route as CountImport } from './routes/count'
|
import { Route as CountImport } from './routes/count'
|
||||||
import { Route as IndexImport } from './routes/index'
|
import { Route as IndexImport } from './routes/index'
|
||||||
|
|
||||||
// Create/Update Routes
|
// Create/Update Routes
|
||||||
|
|
||||||
|
const TeardownRoute = TeardownImport.update({
|
||||||
|
id: '/teardown',
|
||||||
|
path: '/teardown',
|
||||||
|
getParentRoute: () => rootRoute,
|
||||||
|
} as any)
|
||||||
|
|
||||||
const CountRoute = CountImport.update({
|
const CountRoute = CountImport.update({
|
||||||
id: '/count',
|
id: '/count',
|
||||||
path: '/count',
|
path: '/count',
|
||||||
@@ -46,6 +53,13 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof CountImport
|
preLoaderRoute: typeof CountImport
|
||||||
parentRoute: typeof rootRoute
|
parentRoute: typeof rootRoute
|
||||||
}
|
}
|
||||||
|
'/teardown': {
|
||||||
|
id: '/teardown'
|
||||||
|
path: '/teardown'
|
||||||
|
fullPath: '/teardown'
|
||||||
|
preLoaderRoute: typeof TeardownImport
|
||||||
|
parentRoute: typeof rootRoute
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,36 +68,41 @@ declare module '@tanstack/react-router' {
|
|||||||
export interface FileRoutesByFullPath {
|
export interface FileRoutesByFullPath {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/count': typeof CountRoute
|
'/count': typeof CountRoute
|
||||||
|
'/teardown': typeof TeardownRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileRoutesByTo {
|
export interface FileRoutesByTo {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/count': typeof CountRoute
|
'/count': typeof CountRoute
|
||||||
|
'/teardown': typeof TeardownRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileRoutesById {
|
export interface FileRoutesById {
|
||||||
__root__: typeof rootRoute
|
__root__: typeof rootRoute
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/count': typeof CountRoute
|
'/count': typeof CountRoute
|
||||||
|
'/teardown': typeof TeardownRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileRouteTypes {
|
export interface FileRouteTypes {
|
||||||
fileRoutesByFullPath: FileRoutesByFullPath
|
fileRoutesByFullPath: FileRoutesByFullPath
|
||||||
fullPaths: '/' | '/count'
|
fullPaths: '/' | '/count' | '/teardown'
|
||||||
fileRoutesByTo: FileRoutesByTo
|
fileRoutesByTo: FileRoutesByTo
|
||||||
to: '/' | '/count'
|
to: '/' | '/count' | '/teardown'
|
||||||
id: '__root__' | '/' | '/count'
|
id: '__root__' | '/' | '/count' | '/teardown'
|
||||||
fileRoutesById: FileRoutesById
|
fileRoutesById: FileRoutesById
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RootRouteChildren {
|
export interface RootRouteChildren {
|
||||||
IndexRoute: typeof IndexRoute
|
IndexRoute: typeof IndexRoute
|
||||||
CountRoute: typeof CountRoute
|
CountRoute: typeof CountRoute
|
||||||
|
TeardownRoute: typeof TeardownRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
const rootRouteChildren: RootRouteChildren = {
|
const rootRouteChildren: RootRouteChildren = {
|
||||||
IndexRoute: IndexRoute,
|
IndexRoute: IndexRoute,
|
||||||
CountRoute: CountRoute,
|
CountRoute: CountRoute,
|
||||||
|
TeardownRoute: TeardownRoute,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const routeTree = rootRoute
|
export const routeTree = rootRoute
|
||||||
@@ -97,7 +116,8 @@ export const routeTree = rootRoute
|
|||||||
"filePath": "__root.tsx",
|
"filePath": "__root.tsx",
|
||||||
"children": [
|
"children": [
|
||||||
"/",
|
"/",
|
||||||
"/count"
|
"/count",
|
||||||
|
"/teardown"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"/": {
|
"/": {
|
||||||
@@ -105,6 +125,9 @@ export const routeTree = rootRoute
|
|||||||
},
|
},
|
||||||
"/count": {
|
"/count": {
|
||||||
"filePath": "count.tsx"
|
"filePath": "count.tsx"
|
||||||
|
},
|
||||||
|
"/teardown": {
|
||||||
|
"filePath": "teardown.tsx"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
30
packages/example/src/routes/teardown.tsx
Normal file
30
packages/example/src/routes/teardown.tsx
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import { Reffuse } from "@/reffuse"
|
||||||
|
import { createFileRoute } from "@tanstack/react-router"
|
||||||
|
import { DateTime, Effect, Ref, SubscriptionRef } from "effect"
|
||||||
|
import { useMemo } from "react"
|
||||||
|
|
||||||
|
|
||||||
|
export const Route = createFileRoute("/teardown")({
|
||||||
|
component: Teardown
|
||||||
|
})
|
||||||
|
|
||||||
|
function Teardown() {
|
||||||
|
|
||||||
|
const runtime = Reffuse.useRuntime()
|
||||||
|
|
||||||
|
const timeRef = useMemo(() => DateTime.now.pipe(
|
||||||
|
Effect.flatMap(SubscriptionRef.make),
|
||||||
|
runtime.runSync,
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
), [])
|
||||||
|
|
||||||
|
Reffuse.useFork(DateTime.now.pipe(
|
||||||
|
Effect.flatMap(Ref.set(timeRef))
|
||||||
|
))
|
||||||
|
|
||||||
|
const [time] = Reffuse.useRef(timeRef)
|
||||||
|
|
||||||
|
|
||||||
|
return <></>
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user