A variable that looked in scope, and wasn't
Part 1: the sign-out button that only sometimes existed The report A founder came back to /dashboard/ after their session had naturally expired — the dashboard deliberately issues a 24-hour session ( FOUNDER_SESSION_TTL_S , shorter than the 7-day Certified-voter session, because this one gates money-moving actions) — and saw an empty "Your cards" list. Not an error. Not a sign-in prompt. Just...…
The bug occurred when a user signed out from the Kingpin website, but the dashboard remained empty instead of displaying an error message or prompting them to sign in again. This empty state was worse than an error message, as it indicated that the user had no listings, which was alarming for a founder who had paid for premium access to the platform.
The root cause of the issue was a ReferenceError: signOut is not defined in the web/app/dashboard/page.js file. This occurred because the signOut function was defined in the Dashboard component but was not passed down as a prop to the MyListings component, which was rendered inside the Dashboard component. React's component nesting in JSX does not affect JavaScript scope chain, and CardLookup, the component rendering MyListings, did not capture the signOut function from Dashboard.
To fix the issue, the fix mandate was to have the Dashboard component pass the signOut function as a prop to the MyListings component, which would then call the signOut function when the user's session expired. This change was implemented by creating an onSessionExpired prop in Dashboard() and passing it down to MyListings() through CardLookup(). The MyListings component would then call the signOut function when the session expired, ensuring the user was properly signed out and informed about the situation.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.