Michael Schaufelberger
Michael Schaufelberger
Explore posts from servers
TTCTheo's Typesafe Cult
Created by Michael Schaufelberger on 8/9/2023 in #questions
"Body is unusable" or "fetch failed" when using server to upload Zip files
No, I've "quickly" implemented it using AWS S3, since I had to hurry 😅.
5 replies
TTCTheo's Typesafe Cult
Created by 0xpuff on 7/18/2023 in #questions
Full crud request examples & best practices for t3/trpc/react-query?
First of all, tRPC is using react-query for the client. Regarding CRUD: I like to think of tRPC queries/mutations of just functions that run on the backend but give the result back to the client. So, specific functions for the use case you have in a client component. This is different to the classic REST-like CRUD operations where a single entity is the focus of a route. While you can of course build a REST-like CRUD API and use classic REST patterns, you are free to use tRPC how you like. My tip: Get started. Use tRPC in a "functions that run on the backend but give the result back to the client" mindset, i.e. treat it like any other function, and see how that works for you. You are completely free to use tRPC however you like and what the features you are building actually need. One other thing: The query and mutation difference is just - queries' are cacheable, mutations are not. Anything else confused me before I made that distinction.
5 replies
TTCTheo's Typesafe Cult
Created by fasm on 5/23/2023 in #questions
Clerk: auth() was called but it looks like you aren't using authMiddleware in your middleware file
Strange, I have a similar setup. Altough, I'm using getAuth() instead of auth() on the server: import { getAuth } from '@clerk/nextjs/server'; And const auth = useAuth(); on the client. Where do you actually call auth()?
13 replies
TTCTheo's Typesafe Cult
Created by Michael Schaufelberger on 2/7/2023 in #questions
Data fetching strategy with Next.js for a dashboard-like app
Thanks for the insights! I think I'll go with client side fetching and probably not use the server side at all then.
4 replies
TTCTheo's Typesafe Cult
Created by mrnicericee on 2/3/2023 in #questions
Import order
I can also recommend this package. You can even create custom groups to adjust what comes first and what later 😍 https://github.com/lydell/eslint-plugin-simple-import-sort/#custom-grouping
20 replies
TTCTheo's Typesafe Cult
Created by lucca on 2/7/2023 in #questions
Why am I getting these TypeScript ESLint errors even though VSCode doesn't complain?
So, two things: - VS Code probably doesn't complain because you don't have the ESLint extension enabled (See @Cloud 's message), or the extension cannot find the ESLint config file. Make sure to open the repo's root folder in VS Code. - If you look at the rules inside the ESLint config .eslintrc.json (https://github.com/ChromeUniverse/luccanotes/blob/main/.eslintrc.json) you can check which rulesets/plugins are enabled for your project. As you can see @typescript-eslint's recommended-requiring-type-checking is enabled for Typescript files, as well as next/core-web-vitals and @typescript-eslint/recommended . On line 20 you can also see a rule override "@typescript-eslint/consistent-type-imports": "warn" which warns you if you don't add the type keyword to your imports (See @PedeEli 's message). Generally, whenever you have questions about an ESLint rule/error, I recommend googling its definition (https://typescript-eslint.io/rules/consistent-type-imports/). Most rules are well explained, and you can then decide if you want to disable some of them or not. Also, many rules are automatically fixable. You can run the fixing either through the linting CLIs or through your IDE's ESLint extensions.
9 replies