Skip to content

AuthProvider cleanup ejects the response interceptor from the request list #184

Backlog

Description

@fernandatoledo

Problem

AuthProvider registers its interceptor with client.interceptors.response.use but removes it in the effect cleanup with client.interceptors.request.eject (auth.tsx#L151, auth.tsx#L163). The response interceptor is never removed, so every remount of AuthProvider leaves one behind.

Impact

After a remount (Fast Refresh, or tests that render the provider more than once), every API response runs the stale interceptors too. They call checkToken (setToken, setLoading, setReady) on providers that are gone, and on a 401 they would run their old logout. In tests this can also leak state between cases.

Fix

Eject from the same list it was registered on:

client.interceptors.response.eject(responseInterceptor);

Renaming the requestInterceptor variable to responseInterceptor would also make the mismatch harder to reintroduce.

Found while reviewing #183.

Activity

  1. added
    bug
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions