pagwin
pagwin
TTCTheo's Typesafe Cult
Created by pagwin on 7/24/2023 in #questions
Different timings for animating to different states
wait... okay I might be really dumb for not thinking of this sooner from a quick glance just prefixing the appropriate variant onto ease-in-out and duration seems to do the trick hover:ease-in-out+ hover:duration-500 & active:ease-in-out + active:duration-100
3 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/18/2023 in #questions
Implementing next auth adapter with a cache
the error message for point 1 is 'getSessionAndUser is not a function'(or something similar), just wanted to point that out to seo for Answer Overflow
5 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/18/2023 in #questions
Implementing next auth adapter with a cache
okay so I'm gonna assume that there aren't any security issues with what I wrote, regardless I found some other issues 1. due to the way next-auth calls Adapter functions using the normal method for having a method on a class doesn't work you need to have member variables which are set to arrow functions instead 2. my lazy way of dealing with setTimeout via calling the window version was dumb and I ended up using ReturnType instead 3. setTimeout(at least the one Node provides) doesn't like getting a number that's bigger than a signed 32 bit integer can handle so I had to add a safety guard in the Cache setLifespan to max it out at 2^32 - 1
5 replies
TTCTheo's Typesafe Cult
Created by meow on 7/16/2023 in #questions
TRPC vanilla queries (T3 stack)
I've actually done this myself due to not understanding react query so here's a link to my code to yoink https://discord.com/channels/966627436387266600/1126684886745485333/1126753035150962738
4 replies
TTCTheo's Typesafe Cult
Created by Typedef on 7/12/2023 in #questions
Generating 1200x1200 10,000 unique images in lambda.
or maybe 5 calls generating 2k
9 replies
TTCTheo's Typesafe Cult
Created by Typedef on 7/12/2023 in #questions
Generating 1200x1200 10,000 unique images in lambda.
then just make a version of the lambda that can generate some number specified images and make however many calls to that lambda from the main lambda you need to get everything done fast enough, 2 calls generating 4k each then 1 more generating the last 2k
9 replies
TTCTheo's Typesafe Cult
Created by Typedef on 7/12/2023 in #questions
Generating 1200x1200 10,000 unique images in lambda.
I don't have any experience with lambdas or js canvas api but just to spitball some ideas 1. you could reimplement it in a faster language 2. WebGL? 3. screw making it faster and just have the lambda call out to a different lambda which generates one image 10,000 times
9 replies
TTCTheo's Typesafe Cult
Created by Revaycolizer on 7/12/2023 in #questions
Handling cors using axios
you don't, they're both ways of performing http requests, trying to emulate one with the other is unnecessary
4 replies
TTCTheo's Typesafe Cult
Created by whizzy on 7/10/2023 in #questions
Anyone know how to connect to custom domain?
yeah having users transfer their domain to you to manage through some provider's api is also a valid way rather than them setting a CNAME record manually
15 replies
TTCTheo's Typesafe Cult
Created by whizzy on 7/10/2023 in #questions
Anyone know how to connect to custom domain?
you don't manage the dns, you have the user setup a CNAME record so that the domain will point to your server(s) then whenever a request reaches your server(s) you figure out which domain it's for and respond appropriately
15 replies
TTCTheo's Typesafe Cult
Created by whizzy on 7/10/2023 in #questions
Anyone know how to connect to custom domain?
you can have them set a cname record like vercel does and then in the http request look at the Host header to figure out which blog to show
15 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/7/2023 in #questions
Setting up vanilla trpc client
*you're I always use it's even when I should use its so I shouldn't be throwing stones
20 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/7/2023 in #questions
Setting up vanilla trpc client
tbh my random complaint was not intended as a feature request, I agree with that cje said though
20 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/7/2023 in #questions
Setting up vanilla trpc client
thanks
20 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/7/2023 in #questions
Setting up vanilla trpc client
it seems I can't mark your response as a solution due to marking my own thing as a solution which is annoying but oh well
20 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/7/2023 in #questions
Setting up vanilla trpc client
yeah it seems that way, it also seems that I didn't know how to use react query
20 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/7/2023 in #questions
Setting up vanilla trpc client
alright I solved this myself and yeah, I marked it as noob for a reason so yeah(~ is src dir not unix home dir) ~/utils/api.ts creates the react query version of things and that version has the correct object to pass into createTRPCProxyClient so I just copy pasted it into that resulting in this
export const vanilla_api = createTRPCProxyClient<AppRouter>({
/**
* Transformer used for data de-serialization from the server.
*
* @see https://trpc.io/docs/data-transformers
*/
transformer: superjson,

/**
* Links used to determine request flow from client to server.
*
* @see https://trpc.io/docs/links
*/
links: [
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" && opts.result instanceof Error),
}),
httpBatchLink({
url: `${getBaseUrl()}/api/trpc`,
}),
],
});
export const vanilla_api = createTRPCProxyClient<AppRouter>({
/**
* Transformer used for data de-serialization from the server.
*
* @see https://trpc.io/docs/data-transformers
*/
transformer: superjson,

/**
* Links used to determine request flow from client to server.
*
* @see https://trpc.io/docs/links
*/
links: [
loggerLink({
enabled: (opts) =>
process.env.NODE_ENV === "development" ||
(opts.direction === "down" && opts.result instanceof Error),
}),
httpBatchLink({
url: `${getBaseUrl()}/api/trpc`,
}),
],
});
which seems to work for what I want/need to do
20 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/7/2023 in #questions
Setting up vanilla trpc client
reason I tagged this react query btw is because this may be an XY problem and there's actually some way using that to do what I want
20 replies
TTCTheo's Typesafe Cult
Created by pagwin on 7/7/2023 in #questions
Setting up vanilla trpc client
typescript error:
Type error: Argument of type '{ links: TRPCLink<CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<Prisma.PrismaClientOptions, never, Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined, DefaultArgs>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>>[]; }' is not assignable to parameter of type 'CreateTRPCClientOptions<CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined, DefaultArgs>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>>'.
Property 'transformer' is missing in type '{ links: TRPCLink<CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<Prisma.PrismaClientOptions, never, Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined, DefaultArgs>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>>[]; }' but required in type '{ transformer: typeof SuperJSON; }'.

6 | import {useState,type ChangeEvent} from "react";
7 |
> 8 | const trpc = createTRPCProxyClient<AppRouter>({
| ^
9 | links: [
10 | httpBatchLink({
11 | url: "http://localhost:3000"
Type error: Argument of type '{ links: TRPCLink<CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<Prisma.PrismaClientOptions, never, Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined, DefaultArgs>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>>[]; }' is not assignable to parameter of type 'CreateTRPCClientOptions<CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<PrismaClientOptions, never, RejectOnNotFound | RejectPerOperation | undefined, DefaultArgs>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>>'.
Property 'transformer' is missing in type '{ links: TRPCLink<CreateRouterInner<RootConfig<{ ctx: { session: Session | null; prisma: PrismaClient<Prisma.PrismaClientOptions, never, Prisma.RejectOnNotFound | Prisma.RejectPerOperation | undefined, DefaultArgs>; }; meta: object; errorShape: { ...; }; transformer: typeof SuperJSON; }>, { ...; }>>[]; }' but required in type '{ transformer: typeof SuperJSON; }'.

6 | import {useState,type ChangeEvent} from "react";
7 |
> 8 | const trpc = createTRPCProxyClient<AppRouter>({
| ^
9 | links: [
10 | httpBatchLink({
11 | url: "http://localhost:3000"
runtime error:
Unhandled Runtime Error

TRPCClientError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Call Stack
TRPCClientError
node_modules/@trpc/client/dist/transformResult-9a244fe7.mjs (23:0)
from
node_modules/@trpc/client/dist/transformResult-9a244fe7.mjs (13:0)
<unknown>
httpBatchLink/</</</<@webpack-internal:///./node_modules/@trpc/client/dist/httpBatchLink-c184c799.mjs (205:101)
Unhandled Runtime Error

TRPCClientError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
Call Stack
TRPCClientError
node_modules/@trpc/client/dist/transformResult-9a244fe7.mjs (23:0)
from
node_modules/@trpc/client/dist/transformResult-9a244fe7.mjs (13:0)
<unknown>
httpBatchLink/</</</<@webpack-internal:///./node_modules/@trpc/client/dist/httpBatchLink-c184c799.mjs (205:101)
20 replies