@brophdawg11 I think it's their way of discouraging creating promises during render on the client, since consuming it may suspend indefinitely. But if you are ok with the risk and really need to chain callbacks, you can make it a regular Promise like so:
@EvHaus@timneutkens I believe builds may generate type definitions, for instance to ensure the usage of params in a route matches the route's definition/directory structure. And it's possible those definitions are written somewhere that calling tsc manually doesn't include them in the project
@rauchg Definitely seeing a few interesting hacks to achieve dynamic behavior on what I presume is an almost entirely static page. Skills are great, but it would be even better if the page was open source
@rickyfm@devongovett@RyanCarniato I think the other issue is that the async-react working group is invite-only and probably closes off a decent chunk of the community that would be interested from participating in research and discussions
@rickyfm@devongovett@RyanCarniato I think the difference here is that the solution feels like it would need to integrate deeply with how React schedules work. Like I imagine a good chunk of use cases may be covered if React implemented resuming for fibers, but I donโt know how you could do that at a library level
@_chenglou This is awesome. Reminds me a lot of the types of problems I had to solve when I created a meme generator. Not as cool or useful, but I love to see some of the similarities. https://t.co/2i3aNNAkUn
@ChadNauseam I had to implement the backward energy version in Java for a freshman year project, and it's to this day one of my favorite projects. I recently also turned it into a web version, but with pure JS https://t.co/4vAxquLRKo. Super cool that you're using WebGPU.
For anyone still using this performance hack but running into compatibility issues since React 19.2+, I think I've found an idiomatic fix: https://t.co/LiK2NAEKuB
๐คฏ React hydration perf trick
Permits to avoid hydrating a mobile component on a desktop (or the opposite)
Better than hydrating both and hiding one with CSS ๐
How it works?
Deletes the useless DOM element before hydration.
Is this even ok to do so?
@wesbos Maybe there was a time it wasn't implemented yet, but my understanding is that it was always intended to work this way. And it's not specific to server functions; you can do this with references to client functions too. Dan's Functional HTML blog post explains this pretty well
@w2k_@mscccc To be fair, idempotence doesn't mean side-effect free. An unsubscribe link is likely idempotent. But GETs should also be "safe", which unsubscribing is not.
@Snap_Back_Yap@Palmossi_@aaaronson I believe itโs more so how close the letters of a word are to each other alphabetically. โggโ -> low SD. โazโ -> high SD
@yoavabrahami@rutu_3 My guess is requestHandler is allowed to be synchronous, so the OP wants to ensure it returns a Promise, but youโre right that wouldnโt work if it synchronously errors. Promise.try is more likely what they want
@tomasklingen@pontusab Truthfully anything client-only should likely be integrated with Suspense. That way it takes advantage of your app's existing loading sequence. Again, not sure what the perf characteristics are, but I believe it's the most idiomatic approach: https://t.co/gUP5BUsvNE
@tomasklingen@pontusab I wouldn't say it's outdated considering uSES and transitions were both added in v18. But I also don't know enough about React internals to know the perf tradeoff. However, in my experience a top-level hydration context doesn't work well with streaming/lazy-loaded components
@i549@hauke_schnau@adamwathan Well it doesn't really. The render prop is called by the server component; it's never serialized to the client, only its result. The pattern has unproven value in RSC, but my point is just that passing functions to server components is a bit more nuanced than it's "not allowed"
@i549@hauke_schnau@adamwathan Or do you mean 'use client' for something other than a component? I wouldn't say that just happens to work; it's consistent with the higher-level behavior of 'use client'. There's a good article on it: https://t.co/bwFZoFJdlN. But tbh I haven't had a legit use case for it yet.
@i549@hauke_schnau@adamwathan The children function? It's just the render prop pattern. Most use cases for it got replaced with Context and hooks, but it is occasionally useful still.