anderjaska
anderjaska
Explore posts from servers
TTCTheo's Typesafe Cult
Created by anderjaska on 8/25/2024 in #questions
What's the best way to set up unit testing for t3 stack?
title, trying to get jest to work
2 replies
TTCTheo's Typesafe Cult
Created by anderjaska on 12/27/2023 in #questions
caching data from external api
I have an API route that just calls an external API and massages the response a bit. I get maximum 1k api calls per day, so I’d like to cache the responses of this API. Does nextjs/vercel have a built-in way to do this? I read something about how they added some extra options to fetch but I can’t tell if that’s only client-side. Cheers!
3 replies
TTCTheo's Typesafe Cult
Created by anderjaska on 2/15/2023 in #questions
Is it not reccomended to inline SVGs as JSX?
I prefer doing this so as to have the svg be a component that I can pass style props to easily. But for some reason, one svg in particular is around 1KB gzipped! Here's the code for reference:
7 replies
TTCTheo's Typesafe Cult
Created by anderjaska on 11/2/2022 in #questions
What's the T3 way to load a font from google fonts?
above, I have it in _document.tsx right now
class MyDocument extends Document {
render() {
return (
<Html>
<Head>
<link
href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=block"
rel="stylesheet"
></link>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}

export default MyDocument;
class MyDocument extends Document {
render() {
return (
<Html>
<Head>
<link
href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=block"
rel="stylesheet"
></link>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}

export default MyDocument;
27 replies
TTCTheo's Typesafe Cult
Created by anderjaska on 10/28/2022 in #questions
Prisma tips?
So, i've been using prisma migrate dev for every migration for awhile now. But I only just read the docs that you shouldn't use this to migrate (?) other environments like prod and staging What commands do y'all use consistently?
3 replies
TTCTheo's Typesafe Cult
Created by anderjaska on 10/5/2022 in #questions
How to figure out how long a postgres sql query will take
Sorry for the vague q, but I find myself having to write alot of custom sql queries these days to make zapier "be our backend". Zapier will fail the zap if a query times out. But I dont know a good way to gauge at what scale we will reach 30 seconds. Here is a query in question:
SELECT "proposalId", string_agg("ProposalDateRanges"."from" || ',' || "ProposalDateRanges"."to", ';') FROM "public"."ProposalDateRanges" WHERE "ProposalDateRanges"."proposalId" = '{{169303871__id}}' GROUP by "ProposalDateRanges"."proposalId"
SELECT "proposalId", string_agg("ProposalDateRanges"."from" || ',' || "ProposalDateRanges"."to", ';') FROM "public"."ProposalDateRanges" WHERE "ProposalDateRanges"."proposalId" = '{{169303871__id}}' GROUP by "ProposalDateRanges"."proposalId"
So string_agg will scale with the number of ProposalDateRanges per Proposal, and the whole query depends on how many ProposalDateRanges there are in total Sorry my DB knowledge is rather weak
2 replies