ā ļø This post links to an external website. ā ļø
Iāve been vibecoding a little app, and a few days ago I ran into a bug.
The bug went something like this. Imagine a route in a webapp. That route shows a sequence of stepsāessentially, cards. Each card has a button that scrolls down to the next card. Everything works great. However, as soon as I tried to also call the server from that button, scrolling would no longer work. It would jitter and break.
So, adding a remote call somehow broke scrolling.
I wasnāt sure whatās causing the bug. Clearly, the newly added remote server call (which I was doing via React Router actions) was somehow interfering with my
scrollIntoViewcall. But I couldnāt tell how. I initially thought the problem was that React Router re-renders my page (an action causes a data refetch), but in principle thereās no reason why a refetch would interfere with an ongoing scroll. The server was returning the same items, so it shouldnāt have changed anything.In React, a re-render should always be safe to do. Something else was wrongāeither in my code, or in React Router, or in React, or even in the browser itself.
How do I fix this bug?
Can I get Claude to fix it?
continue reading on overreacted.io
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.