react-redux-firebase: bug(profile) inconsistent profile isLoaded, isEmpty states
Do you want to request a feature or report a bug?
Bug
What is the current behavior? In one of the prop states during login process, I get such result:
no auth:
isLoaded(auth) true
isEmpty(auth) true
isLoaded(profile) true
isEmpty(profile) true
after login pressed
isLoaded(auth) false
isEmpty(auth) true
isLoaded(profile) false
isEmpty(profile) true
[corrupted]
isLoaded(auth) true
isEmpty(auth) false
isLoaded(profile) true
isEmpty(profile) true
on next prop, it is auto fixed:
isLoaded(auth) true
isEmpty(auth) false
isLoaded(profile) true
isEmpty(profile) false
However this corrupted state means that user is authenticated but profile is not found (profile path existed in database even before login).
What is the expected behavior?
Corrupted state should not occur. In example, in my app I perform redirect if user is auth
but does not have an entry in database.
Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups? 2.0.10
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 15 (11 by maintainers)
Commits related to this issue
- Profile not set to isLoaded true unless profile is actually loaded - #301 * authError is set to null on LOGOUT and LOGIN actions * LOGIN_ERROR no longer affects profile state - #301 — committed to prescottprue/react-redux-firebase by deleted user 7 years ago
- UNLOAD_PROFILE action type - #301 * QueryId now includes storeAs to fix issue with listeners - #294 * New action type to handle isLoaded state of profile on login — committed to prescottprue/react-redux-firebase by prescottprue 7 years ago
- v2.0.0-beta.15 * feat(auth): `UNLOAD_PROFILE` is dispatched when `login` action creator is called - #301 * feat(auth): `signInWithPhoneNumber` action creator added - #319 * fix(firebaseConnect): fu... — committed to prescottprue/react-redux-firebase by prescottprue 7 years ago
- fix(profile): isLoaded set to false on LOGIN to prevent inconsistent state - #301 * feat(tests): test added to check profile state consistency on LOGIN dispatch - #301 * fix(auth): UNLOAD_PROFILE act... — committed to prescottprue/react-redux-firebase by prescottprue 7 years ago
- v2.0.0-beta.17 (#334) * fix(populate): undefined populate child responds unmodified as expected - #310 * fix(auth): `UNLOAD_PROFILE` action type no longer dispatched (did not fix issue) - #301 * fe... — committed to prescottprue/react-redux-firebase by prescottprue 7 years ago
That is a GREAT point with having profile set to loaded false by the
LOGIN
action.Going to change that now, and it should be ready for the next v2.0.0 pre-release.