react-native-activity-feed icon indicating copy to clipboard operation
react-native-activity-feed copied to clipboard

When token changes, component does not re-render

Open raquelmsmith opened this issue 3 years ago • 0 comments

Setup (always fill this in):

  • iOS or Android?
    • Both
  • Expo or regular React Native?
    • Regular
  • React Native Version: 0.64.1
  • react-native-activity-feed version: 1.1.0

Describe the bug I have users logging in/out. When the token changes when someone logs in (due to different user identifier), I get an error: [Error: {"detail":"You do not have permission to do this, you got this error because there are no policies allowing this request on this application. Please consult the documentation https://getstream.io/docs/","status_code":403,"code":17,"exception":"NotAllowedException","duration":"0.15ms","more_info":"https://getstream.io/docs/api_error_responses"} with HTTP status code 403]

I believe this is because the StreamApp component does not re-render its inner contents (or something) when the token changes, so it tries to fetch the feed using the old token. Or something?

To Reproduce Steps to reproduce the behavior:

  1. Fetch a token for a user. Store it in state and pass it to the StreamApp component.
  2. Render a feed for the current user ID.
  3. Change the user ID (log out, then log in with another account, or simply change the user ID).
  4. Fetch a new token for that new ID. Do not reload the app.
  5. See that the feed does not rerender the whole component (or something) and you get the error.

Expected behavior When the token changes, the component re-renders.

raquelmsmith avatar Feb 24 '22 23:02 raquelmsmith