Skip to content
Andrew Voirol
WorkLogAboutContact
HomeWorkLog

AboutContact

✦ Just one prompt away from figuring it all out.

Sunday, August 2, 2026isoglobe-weather-build

Flickering buildings and deterministic hashing

ReactDebugging

Caught a subtle rendering bug that AI Studio's scaffold would have shipped: buildings changing colors on every re-render. The original code picked building colors with Math.random() inside a useMemo hook — so each state update reshuffled the entire cityscape. Replaced it with a seeded deterministic hash (Math.abs(Math.sin(i * 12.9898 + 78.233) * 43758.5453) % 1) indexed into the theme's color array. Same fix for window light placement and tree positioning. The city now looks stable across re-renders while still appearing randomly distributed. Also added try/catch around JSON.parse() in the Gemini service — without it, a malformed response crashes the app silently. These are the bugs that pass npm run build but break the experience.

← Previous

Five cities, three states, one globe

Next →

The AIS-to-GitHub pipeline that taught itself


Andrew Voirol

Builder, hacker, shipper. Currently leaving localhost.

Navigate

WorkBuilder’s LogAboutContactRSS Feed

Connect

X / TwitterGitHubLinkedIn

© 2026 Andrew Voirol·Back to top ↑
✦Just one prompt away from figuring it all out.