redux-firestore icon indicating copy to clipboard operation
redux-firestore copied to clipboard

bug(reducers): documents with '.' (dot) character in their id are not correctly updated

Open jeanregisser opened this issue 6 years ago • 5 comments

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

Bug

What is the current behavior?

I'm listening to a subcollection like this:

firestoreConnect(({ userId }) => [{
  collection: `users/${userId}/favorites`,
  storeAs: 'favorites'
}])

The favorites are basically a collection of book ids. The book ids contain the '.' (dot) character.

The initial LISTENER_RESPONSE populates the store correctly: screen shot 2018-09-19 at 17 18 18

But then if I try to add another book as favorite:

firestore.set(`users/${userId}/favorites/${bookId}`, {
  savedAt: firestore.FieldValue.serverTimestamp(),
});

It breaks the data store: screen shot 2018-09-19 at 17 22 25

Note that the ordered store is unaffected.

Also If I try to delete a favorite:

firestore.delete(`users/${userId}/favorites/${bookId}`);

It fails to delete it from the data store: screen shot 2018-09-19 at 17 26 01 screen shot 2018-09-19 at 17 26 25 screen shot 2018-09-19 at 17 26 41 screen shot 2018-09-19 at 17 27 32

What is the expected behavior?

When listening to a collection with documents using the '.' (dot) characters in their id, it should correctly handle additions/updates/deletions in firestore.data.

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

This is happening with [email protected] and [email protected]

This is within a React Native project 0.55.3 using [email protected].

Steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.

jeanregisser avatar Sep 19 '18 15:09 jeanregisser

Going to look into addressing this as part of the v1.0.0 releases. There isn't a solve for it yet, but the v1.0.0 Roadmap has been created to track changes.

prescottprue avatar Oct 02 '18 00:10 prescottprue

similar to that problem maybe? https://github.com/prescottprue/redux-firestore/issues/88

compojoom avatar Oct 05 '18 08:10 compojoom

@jeanregisser - check my pull requests if you want. For me it seems to solve the storeAs problem.

compojoom avatar Oct 11 '18 08:10 compojoom

@prescottprue - please have a look at the pull request. I just did the same change in the case where there is no storeAs and meta.path

So far it looks good with our app.

compojoom avatar Oct 11 '18 12:10 compojoom

Closed 427 of react-redux-firebase. Progress on fixing this will be tracked here

prescottprue avatar Sep 05 '19 23:09 prescottprue