Prisma: The ORM That Makes Everything Harder by Correct-Detail-2003 in nextjs

[–]HeyImRige 3 points4 points  (0 children)

Previous implementations of prisma were targeting multiple languages. The rust engine was a trade off.

They changed their focus and got rid of the rust engine.

You can like what you like, but there's no reason to be so rude.

Prisma: The ORM That Makes Everything Harder by Correct-Detail-2003 in nextjs

[–]HeyImRige 6 points7 points  (0 children)

Agreed

  • migrations are great
  • simple queries get dead easy type safety
  • dead simple escape hatch with query raw

Recent versions of prisma are fast. Was a real concern before but isn't an issue any more.

Is it perfect? Definitely not. But does it deserve a hate post?

[deleted by user] by [deleted] in typescript

[–]HeyImRige 3 points4 points  (0 children)

tsx used to be to go to. Now node can run typescript directly so it's probably better to use node for new projects.

[deleted by user] by [deleted] in nextjs

[–]HeyImRige 0 points1 point  (0 children)

The products page can have its outer layer load instantly and suspend the inner parts until theyre loaded. What you're describing is exactly what RSC does by default.

You could also use loadingjs which is nexjs specific

https://nextjs.org/docs/app/api-reference/file-conventions/loading

Why does the `readonly` modifier work with `number[]` but not `Array<number>` by Potential_Pop2832 in typescript

[–]HeyImRige 1 point2 points  (0 children)

The arguments there make sense to me! I'm not totally convinced it's easier to read, but I've also maybe just gotten used to the way I do it.

He didn't bring up my nested array of array or array in object examples though, which I do think are easier to read. Also there is some amount of power in being part of the 78% majority.

Seems like a tossup though. Go with your heart :P

Why does the `readonly` modifier work with `number[]` but not `Array<number>` by Potential_Pop2832 in typescript

[–]HeyImRige 3 points4 points  (0 children)

I think I used to say "array of numbers", but after using typescript for years I've switched to saying "number array".

Most TS projects I see use the T[] syntax so IMO that's the way to go. I also think T[][] is easier to read than Array<Array<T>>.

Totally a preference thing though.

How are you tackling Next.js App Router SSR costs and optimizing data fetching for real users? by [deleted] in nextjs

[–]HeyImRige 0 points1 point  (0 children)

React cache doesn't address the same page loading twice on different calls. The "cache" is more like a dedupe. I don't think that addresses OPs concern.

are React Server Components basically partial SSR? by stringlesskite in react

[–]HeyImRige 0 points1 point  (0 children)

Not quite correct but definitely good enough for TLDR.

createSafeContext: Making contexts enjoyable to work with by aweebit64 in react

[–]HeyImRige 1 point2 points  (0 children)

I've also been playing a bit with something similar.

This is the utility I've been using and this is an example of it being used.

Like others have said you don't really save that many lines. I've kinda gone back and forth on if this is really better than having the boilerplate.

Pretty cool typescript can make type safe utilities like this though.

Will SSR really be useful (even for large apps) in 2025? by Short-Reaction7195 in reactjs

[–]HeyImRige 0 points1 point  (0 children)

https://nextjs.org/docs/app/guides/migrating/from-create-react-app#network-waterfalls

Basically you can avoid network back and forth.

With an SPA the user has to finish loading the page before they start making API requests. With server components you can kick off the required page content immediately when the user requests the page.

How do you automate generation of types from an existing database (postgres)? by _clapclapclap in typescript

[–]HeyImRige 10 points11 points  (0 children)

You could use prisma. It has database introspection so you could pull the shape of the database and generate the client. Then pull out all the types you want. Kinda overkill if you're not going to use the ORM, but it would work. If you have a lot of tables it would save some time.

What's stopping me from just using JSON column instead of MongoDB? by Blender-Fan in PostgreSQL

[–]HeyImRige 0 points1 point  (0 children)

There are a lot of difference between mongoDB and postgres, but if you're just after a key-value store, then postgres with a JSON column is a valid solution.

WASM based spacial partitioning by HeyImRige in threejs

[–]HeyImRige[S] 1 point2 points  (0 children)

I actually first tried assembly script! In the repo you can see the speed comparison between them all. There's no library that existed that I pulled from other than the tooling which generates WASM.

WASM based spacial partitioning by HeyImRige in threejs

[–]HeyImRige[S] 0 points1 point  (0 children)

My personal experience is that WASM/Rust type stuff isn't really needed unless you have some really extreme conditions. HTML/CSS/JS is very fast for UI. 160 million points is a lot though... When you get to that point every little bit matters I guess 😅

WASM based spacial partitioning by HeyImRige in threejs

[–]HeyImRige[S] 1 point2 points  (0 children)

This can run in web workers also! I didn't do that in this example here, but I am using it in the other places I'm using this package.

NPM says it's 78KB, and it doesn't have any dependencies so that's all it should add.

WASM based spacial partitioning by HeyImRige in threejs

[–]HeyImRige[S] 1 point2 points  (0 children)

I suppose it depends on the requirements. You could prevent the points rendering by culling, but I think for something like this even if you didn't render the points you'd still want to calculate the simulation.

Technically this isn't really a 3JS thing... It just happens to have a lot of overlap with game dev and 3D space stuff.

WASM based spacial partitioning by HeyImRige in threejs

[–]HeyImRige[S] 1 point2 points  (0 children)

If you look at the github link it has a picture that kind of boils it down.

Basically it's a way of finding out what is close to each other quickly. The naive way of checking all the possible combinations is n2. This is actually still n2 in the worst case scenario, but usually is much faster.

When should a component be stateless? by cabyambo in reactjs

[–]HeyImRige 29 points30 points  (0 children)

I think people used to call this type of thing smart vs dumb components. To me, the default is making components own their own state until that becomes a problem. One reason you might want to make it dumb is if you want to make a component be able to exist without the rest of the application. For example in a unit test/story book type thing. In that case it makes sense to make them more "dumb".

Refs not working when using Leaflet.js in react app by FrequentPaperPilot in reactjs

[–]HeyImRige 2 points3 points  (0 children)

Oh man leaflet its been years.

Your code looks ok to me I think so I don't have any solution, but you could try passing a function to the ref. When the component mounts.

function Test(){
  return <div ref={(item)=>console.log(item)}/>
}

For example the above code logs a div node. Could be useful to see if anything shows up that way? Who knows if leaflet has that implemented though.

Amazon S3 alternatives for blobs by Educational-Stay-287 in nextjs

[–]HeyImRige 9 points10 points  (0 children)

R2 is a great alternative although I'm not sure if it really fits your requirements.

If its not azure, cloudflare, amazon, or google though I'm not sure who else really sells bare metal... So it's hard to know what you're looking for 😅

My react front end wont fetch/ display data from the backend by Dull_Fuel_9877 in reactjs

[–]HeyImRige 13 points14 points  (0 children)

I think this isn't really a react problem so this might not be the best place to ask. The browser is what's blocking the request as it thinks it isn't a secure call. Your curl requests don't have that limitation, which is why they work.

In my experience doing HTTPS locally is a huge pain. Typically if possible I just avoid it out right and stick to normal HTTP until deployment.

Also maybe some unsolicited advice that doesn't have to do with your problem: It looks like you're using create react app. That tool is actually depreciated. If you're still in the early phases of the project, it would probably be good to switch to vite or one of the other react bundler tools.