dan’s alt Profile picture
Aug 18, 2020 7 tweets 1 min read Read on X
Tutorial: implementing undo/redo is so easy with immutability! You take the previous states and put them in an array and then you can

Reality: color picker putting every intermediate change into history as you drag the cursor is probably not quite what you intended
Tutorial: oh this is easy, you just snapshot only at important times, like when

Reality: good luck deciding when to snapshot your state, before the user has committed their action or after the action has already destroyed the previous state you were supposed to snapshot
This is not to throw shade at immutability. I know it's trying its best and I'm thankful for that
I'll still pick naïve undo/redo with flaws over "rearchitecture your whole app to make it work"
An unrelated action causing to snapshot in-progress state of another action that has not been fully confirmed by the user but has already been reflected to the screen -- OOPS.
I? Have to consciously design my data model to work with undo/redo in a way that makes sense to the user? Never! Paradigm, do the work for me

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with dan’s alt

dan’s alt Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @dan_abramov

Jul 20, 2023
i feel bittersweet sharing i’m leaving my job at meta in a few weeks. working in the react org at meta has been an honor. i am thankful to my past and present colleagues for taking me in, letting me make mistakes, helping me see my strengths, being kind, and sharing their time.
for the past three years, i kept saying i’d leave “in a year or so” but the moment never felt right. i wanted to (1) finish the new docs and (2) see a broadly usable Suspense data fetching integration shipping. after years of work from the team, both have shipped this spring.
i felt hesitant leaving earlier because not too long ago, leaving meta used to mean leaving the react team. that would feel too sad for me. but it is not true anymore. react has become a multi-company project, and there are several independent engineers on the team too.
Read 15 tweets
Jun 7, 2023
fwiw i expected the article to be clickbait (and the title is) but it’s actually pretty balanced. imo it gets a few things wrong so i’ll provide an alternative perspective (tiny thread)
the framing of “existing features like useState / react-query / CSS-in-JS don’t work” is misleading at best.

to understand why, consider that here is the React you already know… A circle saying React Tree ...
… in the RSC paradigm, all of these things keep working! we are not *replacing* that layer — we are adding a *new* layer that can run at the build or request time. that’s Server Components. the only thing they can do is pass data to the “React you already know”… Same picture as before, but...
Read 9 tweets
Jun 6, 2023
yeah i thought this was nice. idk if “spatial computing” will catch on or will stay as an apple-esque “we’re too good to use the industry terms” thing, but i thought it’s funny that this launch simultaneously validated meta’s bet *and* made meta’s branding feel instantly obsolete
mark’s meta announcement felt corny because they had to come up with a vision of mainstream aesthetics for a medium that has no mainstream community yet. of course it’s not believable! apple stuck with floating 2d stuff in the presentation because it feels familiar.
i think this is great news for meta too. i imagine it will be easier to motivate sweating the details and making them cohesive after apple resets the expectations of what this medium is supposed to feel like.
Read 6 tweets
Jun 5, 2023
lol sorry but i think apple did it again
curious what the actual apple vision (not pro) looks like
vision is such a dope name for a product. focuses it on the human (what function does it serve you) rather than on the place you’re supposedly in (whatever reality). “apple vision” also kinda says “this is *the* thing we’re working on”
Read 7 tweets
May 19, 2023
i mean i sorta get the point but also if a ballpen wrote stuff by itself and contained much of humanity’s collective knowledge within, maybe people would have a point being a bit more concerned about ballpens too? it’s more like a phone line with an alien made out of our voices
which is maybe fine, who knows! the internet is pretty good imo and it sure sounds a lot more dangerous than a ballpen. but like idk it’s just such a freaky vibes piece of technology, both natural and freaky like golems or acid. you don’t see language itself reanimated every day.
the closest positive emotional reference i can think of is something like talking to ancestor spirits. and even those stories typically have preexisting oracles instead of groups of people competing to discover and create them. it’s freaky
Read 4 tweets
Apr 20, 2023
real talk. modern frameworks like Next.js and Gatsby have sort of an “SPA mode”. the main difference is with classical SPAs is that they produce several entry HTML files (per route). this means a purely static (not Node!) deploy needs a tiny URL -> path config. this trips people.
we need to get past this hurdle collectively. it is ridiculous if this is the reason we’re delaying adoption of better tools. SPAs with multiple HTML entry files are much better SPAs! we just need some standard way to deploy these across providers.
ideas welcome. i know there are scripts that generate config eg for nginx and apache. cool. i also know some providers infer these paths by default for next and gatsby. also cool. but can we have one obvious way to do it across the ecosystem? so that every single shop knows how.
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(