question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug(orderedReducer): deleting a sub-collection causes a TypeError

See original GitHub issue

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

What is the current behavior? When I try to delete a doc in a sub-collection using object or string notation, I get a TypeError: Cannot read property 'map' of undefined. Although the sub-collection is deleted, my program stops.

props.firestore
        .delete({
          collection: 'teams',
          doc: 'nOAjBoHrtCY7xH0hi0Io',
          subcollections: [
            {
              collection: 'test',
              doc: 'VUnVU8MDp0uBYo9KAfnW'
            }
          ]
        })
// OR
props.firestore.delete('teams/nOAjBoHrtCY7xH0hi0Io/test/VUnVU8MDp0uBYo9KAfnW')
TypeError: Cannot read property 'map' of undefined
    at updateItemInArray (reducers.js:98)
    at Object.removeDoc (orderedReducer.js:100)
    at reducer (reducers.js:123)
    at Object.orderedReducer [as ordered] (orderedReducer.js:196)
    at reducers.js:54
    at Array.reduce (<anonymous>)
    at reducers.js:53
    at index.js:26
    at Array.reduce (<anonymous>)
    at push../node_modules/reduce-reducers/es/index.js.__webpack_exports__.default (index.js:25)
    at combination (redux.js:446)
    at p (<anonymous>:1:36402)
    at v (<anonymous>:1:36684)
    at <anonymous>:1:40069
    at Object.dispatch (redux.js:205)
    at e (<anonymous>:1:40553)
    at actions.js:69

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

"react-redux-firebase": "^2.2.6",
"redux-firestore": "^0.6.1"

Demo: https://codesandbox.io/s/8k8l7no240

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
prescottpruecommented, Jan 3, 2019

@Wgil Always open to help and PRs! The alpha branch contains the current progress on the work outlined in the v1.0.0 Roadmap.

So for help, things I could use:

  • Testing of v1 (install through npm i --save redux-firestore@alpha)
  • Input about the new API. How does it feel? Do you have any input on changes, even drastic ones, to make things easier/cleaner?
  • Help improving the docs of react-redux-firebase and redux-firestore
  • Help making it more clear what needs to be done and how folks should help
0reactions
Wgilcommented, Jan 3, 2019

@prescottprue Just updated the description with the link to the demo. Is there any way I can contribute with the library?

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug(reducers): updates to arrays inside documents don't work ...
I have a similar behaviour with objects in a document (instead of an array) when removing a property. Example : const documentUpdate =...
Read more >
Batch delete documents of a subcollection error: TypeError
I am trying to batch delete a document of a subcollection. There are times when I might need to delete the same product...
Read more >
Deleting data | Firestore - Google Cloud
When you delete a document, Firestore does not automatically delete the documents within its subcollections. You can still access the subcollection ...
Read more >
redux-firebase/Lobby - Gitter
I have done stress test with react-virtualized but seem not to be an issue as each render take only 5 ms max, from...
Read more >
Deletion of sub collections of documents - Google Groups
It seems I have deleted the parents but their subcollection documents remain. How can I delete sub-collection documents which do not have parent...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found