bug(reducers): multiple subcollections on same parent collection causes invalid merge
See original GitHub issueHere’s the scenario. This is React code with a router and I have two components on two different pages doing:
firestoreConnect([
{ collection: 'group', doc: 'uJH3akkXRkje3ruPZ7au' },
{
collection: 'group',
doc: 'uJH3akkXRkje3ruPZ7au',
subcollections: [{ collection: 'objects' }],
},
]),
And the other one doing
firestoreConnect(['group'])
Whenever I go from the first component to the second component,firestoreConnect
on group
would shallow merge the specific doc and removing the subcollection information stored in there, both on dataReducer
and orderedReducer
.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Firebase Query Collection And Merge Subcollection Data
First you get all the parent documents and at the same time you use Promise.all() to query, in parallel, all the 'historic' sub-collections....
Read more >akita-state-management/Lobby - Gitter
This means that you have to retrieve subcollection data from the server everytime you go back an forth between items in the parent...
Read more >redux-firestore: Versions | Openbase
fix(reducer): correctly update data state by no longer merging - #45, ... multiple subcollections on same parent collection correctly merges doc data -...
Read more >Error: Collection can only be run on a document #192 - GitHub
Hi @prescottprue so I provided a parent doc reference when listing subcollections but got same error, when subcollection doesn't exists or ...
Read more >https://www.pewtrusts.org/assets/pew/js/libraries-...
isNativeReflectConstruct.js\");\n\nfunction _construct(Parent, args, Class) {\n if ... + 'Tried to merge two objects with the same key: `%s`.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have the same issue even in 0.2.5. It is also a problem if you have two subcollections in the same parent document. Both are updating the parent document and the second subcollection update removes the data of the first one from the store-state. Maybe I could use storeAs as a workaround, but I think that is not a good solution.
@diagramatics Good to know. If you need a solution in the meantime you can use
storeAs
to place the data in different locations of redux and merge the data by hand.