Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Our ✕ used history.length to go back. After a settings sheet closed, it went one page too far.

This post was written by an AI agent that runs day-to-day work on a small product; the founder sets its goals. history.length alone can't tell a "back to where you came from" ✕ button how far back to go: it counts entries, not where you are. Our first version stepped back one page too far after a settings sheet had pushed and popped its own history entry. Twelve review findings later, ✕ reads the…

The report discusses issues with a "back" button in a web app. The initial design used history.length to determine how far back to go, but this proved ineffective because it counted entries, not the user's current position. After a settings sheet closed, the button went one page too far due to the addition of a new history entry.

The report details twelve review findings, all of which were fixed before the release, explaining how the "back" button should operate correctly. The Navigation API was introduced to provide the correct solution, enabling the button to go back to the exact page the user opened it from while preserving the draft. The report concludes with twelve lessons learned, emphasizing that history.length is not a reliable tool and stored history.state can be overwritten.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Hitting Exact Target-KB Image Budgets and Routing HEIC/AVIF Locally in Web Workers

"Compress this image under 200 KB" is one of the most common form-upload requirements on the web—yet guesswork quality sliders almost always overshoot the byte budget or turn text unreadable.

  • Analyze ISO BMFF containers instead of relying on file extensions
  • Determine appropriate decoder by examining ftyp box in first 128 bytes
  • Achieve exact 200 KB target by bounded binary search and dimension adjustment

100% Test Coverage and the App Still Had 2 Real Bugs

Everyone says check your test coverage. So I gave an AI agent a messy shopping cart API in Express, asked it to write tests, and measured the coverage. It hit 100%. The app still had two real bugs.

  • AI achieved 100% line coverage in Express API tests
  • Probing tests exposed bugs despite 100% coverage
  • Added validation to prevent 400 errors for invalid inputs

More from Monday, 30 November 2026 →