prescottprue / react-redux-firebase

Redux bindings for Firebase. Includes React Hooks and Higher Order Components.
https://react-redux-firebase.com
MIT License
2.55k stars 558 forks source link

LOGIN action clears firebase.profile restored by redux-persist before getting latest profile data. #738

Open tomoyuki28jp opened 5 years ago

tomoyuki28jp commented 5 years ago

What is the current behavior?

I am using react-redux-firebase + redux-persist.

What is the expected behavior?

In the above case, I think it's better not to clear firebase.profile before getting the latest data. (I am really new to react, so I might be wrong.)

Which versions of dependencies, and which browser and OS are affected by this issue? Did this work in previous versions or setups?

davedc commented 4 years ago

Ran into this as well.

@tomoyuki28jp try including this to your rrfConfig. This should make sure that profile and auth data is not cleared.

const rrfConfig = {
  preserveOnLogin: { auth: true, profile: true },
  ...config,
}

@prescottprue The TS types on the config could be updated. Is there any pending issue / PR for this as far as you are aware?

prescottprue commented 4 years ago

@davedc no I don’t believe that is, but yes it would be great to have them as accurate as possible. Feel free to open an issue explaining what is out of sync, or a PR with the changes if you get a chance.

Thanks for reporting and noting the workaround. I think making this more clear in the docs could mean we can close this