@tannerlinsley
(reupload -- read only link now! sry lol)
not strictly about routers, but ur earlier posts nudged me to write up some notes on the mechanics of RSC. has some examples of usage of the RSC APIs + some examples of bundling
(WIP!!)
oh btw. i havent't posted about it yet, but i'll be joining the Next.js team at
@vercel
soon! absolutely over the moon about it & can't WAIT to help cook some new stuff!!!
hey alright, i got SSR of React Server Components kinda working! held together with duct-tape, but it's one server, no need for a separate SSR worker
(my streams are a bit messed up and some stuff gets written before <html> so i'm getting a Quirks Mode warning lol)
finally made some progress on my RSC thing! still quite rough but at least it can SSR properly and refetch (here, it happens after pressing Submit). also made the example show the boundaries a bit better
next stop: a proper router
@tannerlinsley
(reupload -- read only link now! sry lol)
not strictly about routers, but ur earlier posts nudged me to write up some notes on the mechanics of RSC. has some examples of usage of the RSC APIs + some examples of bundling
(WIP!!)
finally made some progress on my RSC thing! still quite rough but at least it can SSR properly and refetch (here, it happens after pressing Submit). also made the example show the boundaries a bit better
next stop: a proper router
moving to berlin has been incredibly good for me. like "new place new me" sounds like a meme but its kinda true
back in warsaw (where i've lived ~all my life) there's like, a lot of history, good and bad. and i feel like the bad parts were kinda holding me back
@vercel
also i'm moving to berlin! so if you're there and wanna grab a coffee or something, lmk! i don't know a lot of people there so gonna be looking to make some new friends <3
oh and if you play MTG, hmu IMMEDIATELY
@dan_abramov2
it's simple, we're using the term "div" in a more generic sense -- a div can also run at build time, so it just means "someone else's container"
@xoxobrien
@dan_abramov
@otakahuynyaa
when have you had to worry about the "implementation" of a for-loop? :) and like, by that metric wouldn't any function call be declarative? that sounds a bit broad... at the end of the day one is a language construct and the other is a method but they're *doing the same thing*
you should be able to see an alpha of my app-router clone running here! proper release coming soon probably
(i need to add like tailwind or something to make this look decent but the point is that nested layouts kinda work)
i was very skeptical of bun's "auto-install imported packages" thing, but damn it's pretty amazing for quick scripts where you don't wanna bother setting up a whole package.json
can't focus on shit today i just keep opening one of 3 apps, scrolling a bit, closing the app, trying to work a bit, failing, and going back to the apps (repeat until ???) this SUCKS
@xoxobrien
@dan_abramov
@otakahuynyaa
and i feel like by this logic we shouldn't use ifs. like, we shouldn't do
myBool ? "it's true" : "it's false"
but instead we should use sth like
myBool.ifElse(() => "it's true", () => "it's false")
i mean, they both end up meaning exactly the same thing, no?
@0xblacklight
@dan_abramov
i'll also plug my own VERY EXPERIMENTAL RSC thing which happens to use express for the server (though tbh express is barely doing any work there, could be a plain http.server)
but mostly as a "beware, it takes a buunch of work to set this up from scratch"
@TheWindHasAWay
@mattpocockuk
maybe this is pedantic but many (most?) statically typed langs compile down to barely-typed languages (assembly/bytecode) with no/few runtime checks. so [not having runtime checks] is not a reason to consider TS weakly typed
it's mostly about escape hatches like `any` or casts
@TaliaRinger
idk like i'm not gonna stand here and say this behavior is good or intuitive but. it does make sense (in the badly-designed context it's in). "counterintuitive" and "nonsensical" aren't the same thing, which i guess is the main thing JS ppl are arguing here
@tannerlinsley
maaaan how did someone manage to delete the whole thing overnight :(((( luckily i made a backup, it's up here (linked in the original one too)
@DasSurma
2:30am *doesn't happen* on that day (bc 2 becomes 3!) so the app shouldn't let you set it, it should prompt for disambiguation (or at least say "THIS'LL ACTUALLY BE 3:30, WATCH OUT")
what do you call it when you decide to take a bundling problem and unwittingly turn it into a distributed systems problem. apart from "being a dumbass"
anyone know any good explanations/intros to webpack's whole Dependency API? the one with dependency factories and templates. bc every time i think i get it, i find something that makes me go "how is THAT a dependency too" and i'm just... confused at this point
@MichaelArnaldi
right, the important part is that Promise.all *makes* you create the promises before awaiting, which'll make them run "in parallel"
but imho it's fine to shorten that to "Promise.all is parallel" for casual conversation. it's not precise but gets the point across
@dan_abramov
all my fav haskell bullshit:
- parser combinators
- Lenses (van Laarhoven ones are nice)
- ADTs in general (Scott encoding is fun too)
- monads babey!
okay my pile of babel hacks for compiling inline "use server" is getting better! it can handle quite a bunch of edge cases now
i think i'm gonna try publishing that as a standalone thing, for my fellow homebrew framework freaks <3
@rossipedia
it's because TS allows passing "wider" types than T as arguments that expect T. so you might get more keys than just `keyof T`, it'd be false type safety
@reactgular
@ZoltanKochan
you don't, because there's no sensible notion of ordering for functions. though of course JS will coerce them to a string and compare that
that has nothing to do with what you said about arrays of numbers not existing
@mattpocockuk
shouldn't you, like, pass in a zod schema instead, and get the output type from that? otherwise it's just kinda hopes & dreams bc there's no verification that the response actually matches what the type says
react PR gossip time!
> uniquely identify an instance of a component between
requests
> we'll need this for two separate features
would be fun if this was for, like, server-side memo() across requests or something
@alicemazzy
i know this is a somewhat tired angle but aren't you worried it'll tell you some nonsense (that you can't identify as such bc you're new to the topic)? fear of that is the main thing that stops me from relying on it more
also i think im underplaying how important the "meeting someone new" aspect has been. like literally the most important. so you need luck for this to work
but also it couldn't have happened w/o moving here. so they're just kinda inextricably linked
@dan_abramov
HTML is a proto-RSC JSX serialization format. the "HTML payload" describes a tree of client components (whose implementations are bundled in the browser itself and are referenced via "well known" string names)
oh sick, looks like i can drop all the proxy code i borrowed from Next from tangle, bc that whole thing got upstreamed into react!
(afaict, it's released in react
@0
.0.0-experimental-fdc8c81e0-20230707)
@reactgular
@ZoltanKochan
what? there very much ARE arrays of numbers in JS. it's just that sort is weird and just converts to a string before comparing (unless you pass a compare-function)
@nico_jeannen
@vercel
i'm sure it sucks to have that happen, but honestly.... if your business model / value proposition can be easily replicated in an app template, it kinda feels like you weren't on very solid ground to begin with?
tricked an online form into letting me edit a disabled field by removing `disabled` from the input element. and it submitted fine! thank you uncontrolled forms and client-side-only validation <3
@syedmuzhasan
@reactjs
@en_JS
@zmofei
it doesn't use signals, it's still just memoization, it's just performed on the level of individual expressions. kind of like to automatically useMemo-ing everything, but more efficient
@dan_abramov
does RSC try to detect/handle client/server version mismatches somehow? like if the client keeps the page open for a week, tries an RSC refetch, but the server changed in the meantime and no longer has the component?
(i'd imagine "graceful" recovery needs framework support)
@AdamRackis
it's rude to put lucas on blast like that. i'm sure the crop is just an unfortunate object-fit: fill, it's not his fault he got cropped out
if you wanna know how i'm doing, i set up a loop that runs the build with all possible combinations of SWC `compress` options to see which one breaks it
update: evidence points to *something* miscompiling babel/standalone (only in the prod build!) in a way that silently changes the parser behavior and breaks `in`. this is gonna be a long fuckin day huh
@tomus_sherman
who had that nice "it goes in spirals, not circles" diagram, it went sth like this... like we revisit the same places but it's better now
@Category_Fury
i like the explanation/theory on wikipedia that it was originally intended for things like
"parking not allowed on Sundays" ~> "parking is allowed on all *other* days"
but then ppl kinda just starting widely misused to say nonsense
@aidenybai
small terminology nitpick: "exponential complexity" would be 3^n, not n^3, i.e. much muuuch bigger
if it's n^3 it's cubic (or polynomial as a more general term)
@deathpigeon
@BrooklynSV_
@SW33TFANG
both things can be true at once
- "it looks blue so it makes sense to just say it's blue"
- "the physical process that produces this particular blue is very different from most blue things, so in some contexts it makes sense to talk about it differently"
@dev_bogdan
@dan_abramov
it makes sense once you get it, but it goes against what ppl think of as "client", so it's kinda understandable imho. and we're going to be repeating it for a while bc you keep getting more ppl new to RSC who don't know it yet
@jessejohnsohn
@sebmarkbage
@dagster
> [Dagster] used RSC [...] on a static hosted website
i.e. no Node server. that limits your RSC usage to running them *at build time*, but you can still use them. i'd say that's the nuance
context is that today was my last day at Stepstone. there was a lot of goodbyes with a lot of cool ppl, and this song somehow always fits when i'm in the mood for reminiscing. thanks for the memories guys, love ya lots <3