cloudlockr / cloudlockr-app

React Native Android app facilitating the user interface for the CloudLockr device featuring bluetooth communication, location services, API integration, file reconstruction, and user management
2 stars 1 forks source link

Investigate possible memory leak when user is logged out due to inactivity #31

Open zfrantzen opened 3 years ago

zfrantzen commented 3 years ago

Currently, when a user is logged out due to inactivity, the runtime environment complains and outputs the error (generated when setting the status code to 403 on the registration page):

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function.

This error is likely due to changing views with the service function. Once the service function returns, the calling function may try to do some state changes (like setting the activity spinner to be not visible). Should probably solve this issue, though at the moment it isn't the highest priority as there's minimal effect being more of an edge case. May require refactoring service handling (promises?) throughout the app, so maybe a large time commitment.

zfrantzen commented 3 years ago

Alternatively, a solution may be to return 3 values from API calls, with the new third value indicating if the user should be sent back to login view. The issue with this is that it is only a partial solution as there will still be problems when we automatically timeout the user after a given amount of time.