forked from saasfly/saasfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 fix(customer): improve customer query performance (saasfly#56)
* 🐛 fix(customer): improve customer query performance * 🐛 fix(app,components): improve formatting and styling * 🔧 chore: Upgrade dependencies in Next.js and Auth packages
- Loading branch information
nextify
authored
May 13, 2024
1 parent
fbb8fbc
commit 8fc0e37
Showing
13 changed files
with
198 additions
and
114 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
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 |
---|---|---|
@@ -1,31 +1,53 @@ | ||
import { loggerLink } from "@trpc/client"; | ||
import { experimental_createTRPCNextAppDirClient } from "@trpc/next/app-dir/client"; | ||
import { experimental_nextHttpLink } from "@trpc/next/app-dir/links/nextHttp"; | ||
import superjson from "superjson"; | ||
|
||
import type { AppRouter } from "@saasfly/api"; | ||
|
||
import { endingLink, transformer } from "./shared"; | ||
import { getUrl } from "./shared"; | ||
|
||
// export const trpc = experimental_createTRPCNextAppDirClient<AppRouter>({ | ||
// config() { | ||
// return { | ||
// transformer, | ||
// links: [ | ||
// // loggerLink({ | ||
// // enabled: (opts) => | ||
// // process.env.NODE_ENV === "development" || | ||
// // (opts.direction === "down" && opts.result instanceof Error), | ||
// // }), | ||
// loggerLink({ | ||
// enabled: () => true, | ||
// }), | ||
// endingLink({ | ||
// headers: { | ||
// "x-trpc-source": "client", | ||
// }, | ||
// }), | ||
// ], | ||
// }; | ||
// }, | ||
// }); | ||
export const trpc = experimental_createTRPCNextAppDirClient<AppRouter>({ | ||
config() { | ||
return { | ||
transformer, | ||
links: [ | ||
// loggerLink({ | ||
// enabled: (opts) => | ||
// process.env.NODE_ENV === "development" || | ||
// (opts.direction === "down" && opts.result instanceof Error), | ||
// }), | ||
loggerLink({ | ||
enabled: () => true, | ||
}), | ||
endingLink({ | ||
headers: { | ||
"x-trpc-source": "client", | ||
experimental_nextHttpLink({ | ||
transformer: superjson, | ||
batch: true, | ||
url: getUrl(), | ||
headers() { | ||
return { | ||
"x-trpc-source": "client", | ||
}; | ||
}, | ||
}), | ||
], | ||
}; | ||
}, | ||
}); | ||
|
||
export { type RouterInputs, type RouterOutputs } from "@saasfly/api"; |
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 |
---|---|---|
@@ -1,42 +1,76 @@ | ||
"use server"; | ||
|
||
import "server-only"; | ||
|
||
import { cookies, headers } from "next/headers"; | ||
// "use server"; | ||
// | ||
// import "server-only"; | ||
// | ||
// import { cookies, headers } from "next/headers"; | ||
// import { loggerLink } from "@trpc/client"; | ||
// import { experimental_createTRPCNextAppDirServer } from "@trpc/next/app-dir/server"; | ||
// | ||
import { cookies } from "next/headers"; | ||
// | ||
// import { endingLink, transformer } from "./shared"; | ||
// | ||
// export const trpc = experimental_createTRPCNextAppDirServer<AppRouter>({ | ||
// config() { | ||
// return { | ||
// ssr: true, | ||
// transformer, | ||
// links: [ | ||
// // loggerLink({ | ||
// // enabled: (opts) => | ||
// // process.env.NODE_ENV === "development" || | ||
// // (opts.direction === "down" && opts.result instanceof Error), | ||
// // }), | ||
// loggerLink({ | ||
// enabled: () => true, | ||
// }), | ||
// endingLink({ | ||
// headers: () => { | ||
// const h = new Map(headers()); | ||
// h.delete("connection"); | ||
// h.delete("transfer-encoding"); | ||
// h.set("x-trpc-source", "server"); | ||
// h.set("cookie", cookies().toString()); | ||
// return Object.fromEntries(h.entries()); | ||
// }, | ||
// }), | ||
// ], | ||
// }; | ||
// }, | ||
// }); | ||
// | ||
import { loggerLink } from "@trpc/client"; | ||
import { experimental_nextHttpLink } from "@trpc/next/app-dir/links/nextHttp"; | ||
import { experimental_createTRPCNextAppDirServer } from "@trpc/next/app-dir/server"; | ||
import superjson from "superjson"; | ||
|
||
import type { AppRouter } from "@saasfly/api"; | ||
|
||
import { endingLink, transformer } from "./shared"; | ||
import { getUrl } from "~/trpc/shared"; | ||
|
||
/** | ||
* This client invokes procedures directly on the server without fetching over HTTP. | ||
*/ | ||
export const trpc = experimental_createTRPCNextAppDirServer<AppRouter>({ | ||
config() { | ||
return { | ||
ssr: true, | ||
transformer, | ||
links: [ | ||
// loggerLink({ | ||
// enabled: (opts) => | ||
// process.env.NODE_ENV === "development" || | ||
// (opts.direction === "down" && opts.result instanceof Error), | ||
// }), | ||
loggerLink({ | ||
enabled: () => true, | ||
}), | ||
endingLink({ | ||
headers: () => { | ||
const h = new Map(headers()); | ||
h.delete("connection"); | ||
h.delete("transfer-encoding"); | ||
h.set("x-trpc-source", "server"); | ||
h.set("cookie", cookies().toString()); | ||
return Object.fromEntries(h.entries()); | ||
experimental_nextHttpLink({ | ||
batch: true, | ||
url: getUrl(), | ||
transformer: superjson, | ||
headers() { | ||
return { | ||
cookie: cookies().toString(), | ||
"x-trpc-source": "rsc-http", | ||
}; | ||
}, | ||
}), | ||
], | ||
}; | ||
}, | ||
}); | ||
|
||
export { type RouterInputs, type RouterOutputs } from "@saasfly/api"; |
Oops, something went wrong.