-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
287 additions
and
98 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { createServerSideHelpers } from './ssgProxy'; | ||
export type { CreateSSGHelpersOptions } from './types'; | ||
|
||
export type { DecoratedProcedureSSGRecord } from './ssgProxy'; |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { | ||
AnyRouter, | ||
ClientDataTransformerOptions, | ||
inferRouterContext, | ||
} from '@trpc/server'; | ||
import { CreateTRPCReactQueryClientConfig } from '../shared'; | ||
|
||
interface CreateSSGHelpersOptionsBase<TRouter extends AnyRouter> { | ||
router: TRouter; | ||
ctx: inferRouterContext<TRouter>; | ||
transformer?: ClientDataTransformerOptions; | ||
} | ||
export type CreateSSGHelpersOptions<TRouter extends AnyRouter> = | ||
CreateSSGHelpersOptionsBase<TRouter> & CreateTRPCReactQueryClientConfig; |
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export { | ||
/** | ||
* @deprecated use `@trpc/react/server` instead | ||
*/ | ||
type CreateSSGHelpersOptions, | ||
/** | ||
* @deprecated use `@trpc/react/server` instead | ||
*/ | ||
type DecoratedProcedureSSGRecord, | ||
/** | ||
* @deprecated use `import { createServerSideHelpers } from "@trpc/react/server"`; | ||
*/ | ||
createServerSideHelpers as createProxySSGHelpers, | ||
} from '../server'; | ||
|
||
export { createSSGHelpers } from './ssg'; |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { createAppRouter } from '../__testHelpers'; | ||
import { createProxySSGHelpers } from '@trpc/react-query/src/ssg'; | ||
|
||
let factory: ReturnType<typeof createAppRouter>; | ||
beforeEach(() => { | ||
factory = createAppRouter(); | ||
}); | ||
afterEach(async () => { | ||
await factory.close(); | ||
}); | ||
|
||
test('dehydrate', async () => { | ||
const { db, appRouter } = factory; | ||
const ssg = createProxySSGHelpers({ router: appRouter, ctx: {} }); | ||
|
||
await ssg.allPosts.prefetch(); | ||
await ssg.postById.prefetch('1'); | ||
|
||
const dehydrated = ssg.dehydrate().queries; | ||
expect(dehydrated).toHaveLength(2); | ||
|
||
const [cache, cache2] = dehydrated; | ||
expect(cache!.queryHash).toMatchInlineSnapshot( | ||
`"[[\\"allPosts\\"],{\\"type\\":\\"query\\"}]"`, | ||
); | ||
expect(cache!.queryKey).toMatchInlineSnapshot(` | ||
Array [ | ||
Array [ | ||
"allPosts", | ||
], | ||
Object { | ||
"type": "query", | ||
}, | ||
] | ||
`); | ||
expect(cache!.state.data).toEqual(db.posts); | ||
expect(cache2!.state.data).toMatchInlineSnapshot(` | ||
Object { | ||
"createdAt": 0, | ||
"id": "1", | ||
"title": "first post", | ||
} | ||
`); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.
515b058
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
www – ./www
trpc.io
www-git-main-trpc.vercel.app
www.trpc.io
beta.trpc.io
www-trpc.vercel.app
alpha.trpc.io
515b058
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
next-prisma-starter – ./examples/next-prisma-starter
nextjs.trpc.io
next-prisma-starter-git-main-trpc.vercel.app
next-prisma-starter-trpc.vercel.app
515b058
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
og-image – ./www/og-image
og-image-trpc.vercel.app
og-image.trpc.io
og-image-three-neon.vercel.app
og-image-git-main-trpc.vercel.app