Skip to content

Commit

Permalink
fix: take out dotenv
Browse files Browse the repository at this point in the history
  • Loading branch information
wenhua.shi committed May 23, 2024
1 parent e1c3111 commit 9c9a552
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 24 deletions.
31 changes: 18 additions & 13 deletions packages/next-core/src/trpc/create-trpc-next-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,23 +153,28 @@ export function createTRPCNextLayout<TRouter extends AnyTRPCRouter>(
const queryKey = getQueryKey(path, input, lastPart === 'fetchInfinite');

if (lastPart === 'fetchInfinite') {
return queryClient.fetchInfiniteQuery(queryKey, () =>
return queryClient.fetchInfiniteQuery({
queryKey: queryKey,
queryFn: () =>
procedure({
getRawInput: async () => input,
path: fullPath,
ctx,
type,
}),
initialPageParam: undefined,
});
}

return queryClient.fetchQuery({
queryKey: queryKey,
queryFn: () =>
procedure({
getRawInput: async () => input,
path: fullPath,
ctx,
type,
})
);
}

return queryClient.fetchQuery(queryKey, () =>
procedure({
getRawInput: async () => input,
path: fullPath,
ctx,
type,
})
);
}),
});
}) as CreateTRPCNextLayout<TRouter>;
}
3 changes: 3 additions & 0 deletions packages/next-demo/prisma-merge.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { prismaMerge } from '@hyperse-io/next-prisma';
import { luciaPrismaContent } from '@hyperse-io/next-auth';
import dotenv from 'dotenv';

dotenv.config();

prismaMerge({
luciaPrismaModel: luciaPrismaContent,
Expand Down
16 changes: 9 additions & 7 deletions packages/next-demo/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ datasource db {
generator client {
provider = "prisma-client-js"
}
model Post {
id String @id @default(uuid())
title String
text String
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
}
model User {
id String @id
username String @unique
Expand All @@ -24,6 +31,7 @@ model Authorized {
user User @relation(name: "AuthorizedToUser", fields: [userId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@index([userId])
}
model Session {
id Int @id @default(autoincrement())
Expand All @@ -33,11 +41,5 @@ model Session {
user User @relation(name: "SessionToUser", fields: [userId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Post {
id String @id @default(uuid())
title String
text String
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
@@index([userId])
}
1 change: 0 additions & 1 deletion packages/next-prisma/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"dependencies": {
"@prisma/generator-helper": "5.14.0",
"@prisma/internals": "5.14.0",
"dotenv": "16.4.5",
"glob": "^10.3.16"
},
"devDependencies": {
Expand Down
3 changes: 0 additions & 3 deletions packages/next-prisma/src/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@ import {
type GeneratorConfig,
} from '@prisma/generator-helper';
import getPrismaConfig from '@prisma/internals';
import dotenv from 'dotenv';
import * as glob from 'glob';

dotenv.config();

import {
deserializeEnums,
deserializeDatasources,
Expand Down

0 comments on commit 9c9a552

Please sign in to comment.