Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(reducers): ordered state not updated with added item in array #116

Closed
michaelspeed opened this issue Jul 2, 2018 · 3 comments
Closed

Comments

@michaelspeed
Copy link

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
If i add a document to firestore, the state at
state.firestore.ordered['someList]
will not update correctly, all the existing items will still be in the array, with repeated items along with the new item, when i update an item the item still remains in the state, and the updated item will add itself to the array. this leads to repeations
What is the expected behavior?
Expected is to delete the whole array from the state, and then create new item with the existing item.

Which versions of dependencies, and which browser are affected by this issue? Did this work in previous versions or setups?
react-redux-firebase: 2.1.6
redux-firestore: 0.5.7

@prescottprue
Copy link
Owner

There have been a number of issues reported relating to how subcollections are stored. To address these, I have started the v1.0.0 Roadmap doc which includes notes about the current plans for the new state pattern.

This new state pattern should make it relatively easy to debug issues like this.

@prescottprue
Copy link
Owner

prescottprue commented Oct 2, 2018

Just to clarify:

Are you adding the document directly to state or calling a method to write to Firestore? Writes directly to state WILL NOT update Firestore or RTDB, it requires calling a method which in turn dispatches an action.

Since there are others that have 👍 I am going to assume that you are in fact writing to Firestore and I am just misunderstanding the description. Going to attempt to replicate.

@prescottprue prescottprue changed the title [bug][ORDERED items are not updated correctly] bug(reducers): ordered state not updated with added item in array Oct 2, 2018
@prescottprue prescottprue mentioned this issue Oct 2, 2018
8 tasks
prescottprue added a commit that referenced this issue Oct 3, 2018
* feat(reducers): `ordered` and `data` reducer using new v1 state pattern outlined in [the v1.0.0 roadmap](https://github.com/prescottprue/redux-firestore/wiki/v1.0.0-Roadmap) (full query path in ordered, sub-collections separate from doc in data)
* feat(core): `firestoreDataSelector ` and`firestoreOrderedSelector` utilities for selecting values from state
* fix(reducers): `LISTENER_RESPONSE` action not correctly updating state for sub-collections - #103
* fix(reducers): `ordered` state not updated with added item in array - #116
* fix(reducers): updates to arrays inside documents don't work as expected - #140
@michaelspeed
Copy link
Author

i think this is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants