ryer.io

Debugging Disappearing Nav Components on Logout

TL;DR

  • Screen elements were disappearing on logout.
  • Isolated the issue to the isLoggingOut state causing unintended UI changes.
  • Realized the problem might be with auth.userRoles or user.programs changing unexpectedly.
  • Narrowed down further exploration needed into user.programs.

I tackled bug 2732 where logging out mistakenly removed navigation elements. After reproducing the issue, I suspected isLoggingOut state was the trigger. A detailed console log analysis led me to consider that dynamic changes in auth.userRoles or user.programs might cause UI hiccups. Here’s my step-by-step breakdown:

Today, I dove into bug 2732, where logging out from the nav screen caused key components to disappear unexpectedly. Reproducing the bug was straightforward: go to the nav screen, hit logout, and watch several components vanish.

My Step-by-Step Debugging Process:

  1. Initial Hypothesis:

    • My first instinct was to check the authentication context, especially around the sign-out logic.
    • I suspected the logout action was affecting render somewhere.
  2. Console Logging:

    • To track this, I inserted console.log statements in the app menu, targeting the button that disappears (“My Vision”).
    • Observed: My Vision disappears on logout, while others behave unpredictably upon cancel.
  3. State Exploration:

    • I traced the steps in the auth context. Upon clicking logout, isLoggingOut was set to true.
    • I added a console.log after removeCredentials function.
  4. Dependency Troubleshooting:

    • Checked the use effect’s dependence on isLoggingOut, noting that it seems to trigger unnecessary re-renders.
    • Placed console.log statements to verify outputs post-logout and upon hitting cancel.
  5. Auth State Lookups:

    • Investigated if the auth context was causing these inconsistencies.
    • Focused on roles and programs: auth.userRoles and user.programs could be subject to unexpected changes.
  6. App Menu Logic:

    • I explored the app menu code, which had logic dependent on isLoggingOut to manage component visibility.
    • Any changes to these dependencies could ripple through the UI state unexpectedly.

After these steps, I still find it necessary to further dive into how auth.userRoles and user.programs interact when logout attempts occur without completing. Specifically, understanding how these states influence the UI could reveal discrepancies.

In summary, this session underscored the significance of detailed console logging, mindful state management, and tackling dependencies in an exploratory yet systematic manner. For further action, a deeper probe into user.programs is required to fully patch this bug.

Stay tuned for more bug squash sessions as the investigation goes deeper!