react-redux-firebase
react-redux-firebase copied to clipboard
feat(auth): presence/session supports auth state (currently just connected state)
Do you want to request a feature or report a bug?
Bug
(If this is a usage question, please do not post it here—post it on gitter. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)
What is the current behavior? After logging out (using firebase.logout() method), the 'onlineUsers' and 'sessions' collection in RealtimeDB does not update immediately until I refresh the page.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.
- Config react-redux-firebase with { presence: 'onlineUsers', sessions: 'sessions' }
- Log in using firebase.login() method
- Log out using firebase.logout() method
What is the expected behavior? 'onlineUsers' and 'sessions' should update immediately after user log out from app.
Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups? I'm using the lastest version { "firebase": "^5.5.6", "react-redux-firebase": "^2.1.9"}
This would be because firebase's onDisconnect is actually talking about connecting/disconnecting from the database not unauth vs auth. I agree that it unclear per the names "presence" and "sessions", so I'll look into making a change for this. Seems like both may still be useful.
Thank you for your reply. To my way of thinking, after logging out successfully, the user ends their authorized session and start a new anonymous session (?). I'm not sure if anonymous session is a good idea, I'm very glad to hear your opinion on this :D
@Dong-Nhan yes, anonymous auth is a great idea, especially if you want to be tracking the users when they aren't logged in. It also helps with writing security rules if some of your data is public and other parts are not (super common).
Going to leave this ticket open to handle adding this feature.