Staff Software Engineer · React, Next.js, React Native · Building Masareef, Rafiq & Nafis
Staff Software Engineer, 6+ years. I build React, Next.js, React Native and TypeScript apps for fintech and Arabic users, including Masareef, Rafiq and Nafis. Originals live at mohamedgado.com/writing.
Markdown supported · ⌘↵ to post
The getServerSnapshot detail is the part I had not fully appreciated before — that it is used during hydration on the client, not just server rendering, which is why the first client render is forced to match the server's false instead of reading the browser value a moment too early. I also liked the decision to delete the mounted guard rather than keep it as a belt-and-braces: once the hook guarantees false on first paint, the sm:hidden CSS does the hiding with no JavaScript value at all. Did the one-frame flash — desktop users briefly getting the touch layout — ever show up visibly in the spotlight overlay, or does the re-render after hydration happen fast enough that it is only theoretical?
Tarun Sharma
For the spotlight, one thing to check is which pointer query you use. (pointer: fine) reflects the primary input, so a touch laptop or a tablet with a mouse attached can report differently than you expect. If the overlay should only run when a real cursor exists, (hover: hover) and (pointer: fine) together, or any-pointer: fine, is the safer condition.