Skip to content

Commit

Permalink
More changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lemonmade committed Sep 6, 2024
1 parent a3402f7 commit affdc74
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/nasty-chicken-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@quilted/create': patch
---

Update template dependencies
5 changes: 5 additions & 0 deletions .changeset/pink-onions-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@quilted/trpc': patch
---

Fix issues with trpc integration
6 changes: 3 additions & 3 deletions integrations/trpc/source/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {callProcedure, type AnyTRPCRouter} from '@trpc/server';
import {observable} from '@trpc/server/observable';
import {
TRPCClientError,
createTRPCClient,
createTRPCUntypedClient,
type CreateTRPCClientOptions,
type TRPCLink,
} from '@trpc/client';
Expand All @@ -12,9 +12,9 @@ export function createDirectClient<Router extends AnyTRPCRouter>(
router: Router,
{links = [] as any}: Partial<CreateTRPCClientOptions<Router>> = {},
) {
return createTRPCClient<Router>({
return createTRPCUntypedClient<Router>({
links: [...links, directLink(router)],
} as any);
});
}

export function directLink<Router extends AnyTRPCRouter>(
Expand Down
4 changes: 2 additions & 2 deletions packages/create/templates/app-trpc/shared/trpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {CreateTRPCClient} from '@trpc/client';
import type {TRPCUntypedClient} from '@trpc/client';
import {createTRPCReact, type CreateTRPCReact} from '@trpc/react-query';
import type {QueryClient} from '@tanstack/react-query';

Expand All @@ -12,7 +12,7 @@ export const trpc: CreateTRPCReact<AppRouter, {}> =

declare module '~/shared/context.ts' {
interface AppContext {
trpc: CreateTRPCClient<AppRouter>;
trpc: TRPCUntypedClient<AppRouter>;
queryClient: QueryClient;
}
}
9 changes: 3 additions & 6 deletions tests/e2e/integrations/trpc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import {describe, it, expect} from 'vitest';
import {multiline, createWorkspace, startServer} from '../utilities.ts';

describe('trpc', () => {
it('can server and client render a trpc query', async () => {
await using workspace = await createWorkspace({
fixture: 'basic-app',
debug: true,
});
it('can server and client render a trpc suspense query', async () => {
await using workspace = await createWorkspace({fixture: 'basic-app'});

await workspace.fs.write({
'trpc.ts': multiline`
Expand Down Expand Up @@ -74,7 +71,7 @@ describe('trpc', () => {
const trpcClient = trpc.createClient({
links: [
httpBatchLink({
url: new URL('/api', url).href,
url: new URL('/api', browser.request.url).href,
}),
],
});
Expand Down

0 comments on commit affdc74

Please sign in to comment.