Ruben Silva
Ruben Silva
KKinde
Created by Ruben Silva on 1/12/2024 in #💻┃support
Error: this method must be invoked in a node.js environment
Thank you for the response. I was experimenting with rendering server components inside client components, and that's where the error could be occurring.
4 replies
TTCTheo's Typesafe Cult
Created by fotoflo on 10/29/2023 in #questions
Where to put / how to cache frequently used user info?
Are you mentioning the query keys (["user"])? If so, those keys are some sort of cache identifiers. Every piece of data that you store as cache, is labeled with a query key, so that when you need to make something with it, like revalidating it, you can target it with the query key.
13 replies
TTCTheo's Typesafe Cult
Created by fotoflo on 10/29/2023 in #questions
Where to put / how to cache frequently used user info?
Alternately, you could use tRPC on the server, but I'm not sure NextJs would store the data on the server cache.
import { httpBatchLink } from "@trpc/client";
import { appRouter } from "@/server";

export const serverClient = appRouter.createCaller({
links: [
httpBatchLink({
url: "http://localhost:3000/api/trpc",
}),
],
});
import { httpBatchLink } from "@trpc/client";
import { appRouter } from "@/server";

export const serverClient = appRouter.createCaller({
links: [
httpBatchLink({
url: "http://localhost:3000/api/trpc",
}),
],
});
13 replies
TTCTheo's Typesafe Cult
Created by fotoflo on 10/29/2023 in #questions
Where to put / how to cache frequently used user info?
My bad, I thought you weren't using tRPC. In that case, because tRPC uses React Query under the hood, you can take a look at their caching examples. Basically you define a query key for your request (["user"] in your case), and every time a request is made using that key, it will fetch the data that was stored on the cache, and when you use a mutation to update that data, you will need to invalidate that query to update it with the fresh data. You can find a better explanation in the links below: https://tanstack.com/query/latest/docs/react/guides/caching https://tanstack.com/query/latest/docs/react/guides/invalidations-from-mutations
13 replies
TTCTheo's Typesafe Cult
Created by fotoflo on 10/29/2023 in #questions
Where to put / how to cache frequently used user info?
By default, all data you fetch using the fetch API, is cached. You can have the same fetch request in multiple pages or components, it will only make one request. The problem, in your case, is that your user session is indeed too complex, every time you add a new team, you will need to revalidate the cached data. It would be better for perfomance, to just restructure your data object.
13 replies
TTCTheo's Typesafe Cult
Created by ali on 10/29/2023 in #questions
should i really use nextjs fronbent ?
Honestly, REST is still the industry standard, to connect backend endpoints to your frontend framework of choice. Just because Vercel has the goal to make NextJs a fullstack framework, that doesn't mean the industry standards will change.
5 replies
TTCTheo's Typesafe Cult
Created by iboughtbed on 10/29/2023 in #questions
Best React (Next.js) PDF libraries?
6 replies
TTCTheo's Typesafe Cult
Created by Giuliopime on 10/17/2023 in #questions
Border that transitions trough row of elements
If you can do it with JS, you can also do it in React or Svelte. I won't say that this is impossible to accomplish with CSS only, but the amount of work it would take it's not worth the effort.
10 replies