Dice Lock's last giant screens file is gone, and typing it caught a bugDice Lock's last giant screens file is gone, and that caught a hidden bug

November 15, 2026 · Dice Lock's 6,707-line screens file is finally gone, split one screen at a time, and making it fully type-checked caught a bug nobody had noticed.Dice Lock's giant screens file is finally gone, split into one file per screen, and making that change caught a bug nobody had noticed.

Dice Lock had one file that drew almost the entire game. For several tickets now, Dice Lock's interface code has been pulling itself out of it: web/dicelock/ui/screens.ts, which at its peak held a single class drawing nearly every screen in the game: settings, accounts, records, scores, friends, how-to-play, style, and more. Each ticket moved one group of screens into its own file. Today's commit finished the job. What was left of the original file is now deleted outright, all 6,707 lines of it. What remains of the Screens class is a 1,640-line shell that only handles the parts every screen shares: showing and hiding layers, the tab bar, the header, the invite banner, and which sheet has focus. Every screen now lives in its own file under ui/screens/, one per screen, listed by name in a registry.

The split came with a type change that mattered more than the file move itself. main.ts's reference to the shell, Game.screens, used to be typed as any, which lets a call to a method that doesn't exist on an object pass silently. It's now declared as the real Screens type, so a call like that fails to compile instead. That check caught a real, live bug left over from an earlier step in the same cleanup: a function called findFriendCode() was still calling this.screens.focusArrivalField?.(), a method that had quietly stopped existing once the account screens were pulled out into their own file. Because the call used a safe, do-nothing-if-it's-missing form, nothing ever complained, and a player who typed in a bad friend code just never got the cursor back in the box to try again. The fix calls the arrival screen's own focusArrivalField() directly, and a new assertion in the test suite checks the cursor comes back.

The rest of the move was meant to change nothing else. The same 579 exported pieces of text from the old file read exactly the same from their new homes, the page's download size moved by about a kilobyte either way, and the full test suite, 9,208 tests, passes the same as it did before the change.

For a while now, the team has been breaking up one enormous piece of code in Dice Lock that used to be responsible for drawing almost every screen in the game at once: menus, settings, your account, your saved records, your scores, your friends list, the how-to-play pages, and more. Each earlier piece of work moved one group of those screens out into its own, smaller file. Today's work finished the job and deleted what was left of the original file completely, all 6,707 lines of it. What's left in its place is a much smaller piece, about a quarter the size, that only handles the one thing every screen needs in common: showing and hiding itself, the row of tabs at the bottom, the header, the little banner about invites, and which box on screen has the typing cursor. Each screen itself now lives in its own separate, easy-to-find file.

Splitting the code up also meant tightening a safety check around it, and that mattered more than the reorganizing itself. The game's main code used to refer to that shared screen-handling piece in a loose way that let it call something that doesn't actually exist on it without any warning at all. It's now checked strictly, so a call like that gets caught immediately instead of silently doing nothing. That stricter check caught a real bug left over from an earlier step in this same cleanup: when a player typed in a friend code and it got rejected, the game was supposed to put the typing cursor back in the box so they could try again, but the piece of code responsible for that had quietly stopped existing once an earlier change moved the account screens out on their own. Nothing complained, because the way it was written just skipped over the problem instead of raising it. That's fixed now: a rejected friend code puts the cursor back where it belongs, and a new automated check confirms it going forward.

The rest of the change was meant to leave everything else exactly as it was: every piece of on-screen text reads the same as before, how much data the page downloads barely moved either way, and the game's entire set of more than nine thousand automated tests passes exactly as it did before the change.