Dan Profile picture
Jan 19 9 tweets 3 min read
react’s own tests often (need to) look funny a deeply nested markup with several level of Bailout compone
if you’re curious, i’m trying to fix this bug in react. it comes up when using code splitting with react router <Switch> and other cases. it’s been reported a while ago. it’s easy to work around so it wasn’t urgent but i wanted to look into it for a while. github.com/facebook/react…
the submitter of the issue was kind enough to send a pull request with a minimal failing test encapsulating the issue. this alone has significantly increased the chances that i would be able to find the bug. (when in doubt, send a failing test!) github.com/facebook/react…
there was also a community PR that attempts to solve the problem. it solves the bug. but i was hesitant because it fixes the main symptom, whereas i was concerned there has to be a deeper problem and some internal assumption led to this bug being possible. github.com/facebook/react…
i put a bunch of console logs in the code and investigated, trying to understand the original assumptions. i narrowed it down to a loop that seems to exit too early. it took me a few attempts but thanks to @acdlite’s tips i think i have a fix that works github.com/facebook/react…
initially i didn’t understand the code quite correctly. @acdlite noticed this didn’t fail the tests and suggested how to write one. i wrote one, and indeed, my code was still broken! you can see in last two commits how i fixed it and then hardened the test coverage for that bit.
anyway, that is just to say that writing code sometimes feels like detective work. first it is frustrating that you don’t understand how something works, but then you have a rough idea, then you have a flawed fix. at some point you just have the right fix and know how it works.
it is interesting to me how a failing test for one scenario has led to a change in a piece of code, which after a good review indicated insufficient coverage for a different scenario, leading to an extra test for that other scenario. fixing one bug hardened tests for other cases.
oh, and after the right fix? then you forget. that’s why you leave comments and PR descriptions behind.

• • •

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

Keep Current with Dan

Dan 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

Jan 19
is there a science fiction novel where there are many parallel worlds but people in some of them use this knowledge to covertly A/B test major decisions (eg policy) across worlds
answer: a whole lot
i guess a bunch of these are more “personal choice” whereas i’m thinking more like meta-world scientists being able to run controlled experiments and write papers about the parallel worlds
Read 10 tweets
Dec 29, 2021
thread of things i put some effort into
Read 16 tweets
Dec 24, 2021
one of the most obnoxious traits of the “web3” community is labeling existing web experts as “web2 people”. it’s disingenuous because web expertise is usually related to frontend, and “web3” apps, from what i understand, still build UI the same way — HTML, CSS, and JS.
from what i can tell, “web3” is a different approach to building the backend and a different set of values/philosophies. if y’all hope to attract the frontend expertise you desperately need to make your stuff usable, consider not making asses of yourselves by labeling outsiders.
the “web3” branding is, in my opinion, genius and designed to be polarizing. it implies obsolescence and induces FOMO. but it’s just that, a branding. unless you literally reinvent the browser, don’t get too carried away excluding people :)
Read 7 tweets
Dec 23, 2021
i have questions about crypto, web3, and the surrounding ecosystem. i’m gonna thread these. please feel free to reply! but don’t start arguments and fights with other people who reply or i’ll use the banhammer.
1. what is bitcoin’s plan to solve its energy consumption problem? is that on the radar of the team/community? is that considered a non-problem / “worth it”? asking specifically about bitcoin
2. why is there a lot of skepticism around ethereum’s move to PoS? is it because it’s been continually pushed back, or is there skepticism that it will work at all? both?
Read 22 tweets
Dec 17, 2021
properly trying VR for more than a few minutes. got myself a quest 2. what is the coolest/whackiest shit i can do with it? i like music, trippy stuff, idk
maaaaan the whole setup process with a virtual “boundary” and a lo-fi see-through of the room in black and white is already trippy as hell and i am here for it
i am surprised to the degree to which the “slightly wrong” virtual ghost fingers don’t bother me. i believe this
Read 7 tweets
Dec 14, 2021
a hundred things i learned working on the react team @threadapalooza
1. every few years your audience changes. new users don’t appreciate problems of the past bc never seen them. old users burn out or lose excitement. new users have different reference frame, learned in diff ways, you might be their first programming env. plan accordingly.
2. when you fix a problem you better really really understand the problem you’re fixing. take a few steps back and reintegrate new knowledge into the design. should it change the design? it’s like fighting a hydra: solving a problem in the wrong spot spawns 10 new problems.
Read 103 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

Too expensive? 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 on Twitter!

:(