Deleting object properties doesn't update the UI since 0.3.1
See original GitHub issueDo you want to request a feature or report a bug?
Bug
What is the current behavior?
If you have an object within a document, then deleting keys from that object doesn’t update the firestore.data
variable, however firestore.ordered
is updated. This means the if the component uses firestore.data
then the UI is not updated to reflect deleted keys. The database is correctly updated and refreshing the browser shows the expected values.
See https://codesandbox.io/s/m3jm3roko8 for an example.
In both 0.3.1
and <0.3.1
I can add an item and have it appear in the UI. The Redux diff looks like this for 0.3.1
and like this for 0.2.8
However when deleting items, 0.3.1
has this diff:
and 0.2.8
has this diff
Note that 0.3.1
only deletes the ordered
value, but leaves the data
value intact while 0.2.8
correctly deletes its data
value and doesn’t set an ordered
value.
What is the expected behavior?
Values in firestore.data
are updated to reflect the database value when object properties are deleted. This occurs as expected prior to 0.3.1
.
Which versions of dependencies, and which browser are affected by this issue? Did this work in previous versions or setups?
See code sandbox
Steps to reproduce and if possible a minimal demo of the problem via codesandbox or similar.
https://codesandbox.io/s/m3jm3roko8
Hit the add and delete buttons. Notice that items are added correctly, but not removed when they are deleted. Hit refresh and the deleted items will go away.
It’s a bit fiddly, but you can remove the redux-firestore
dep and change it to 0.2.8
then refresh to try with the working version, although it sometimes takes a few tries to change the version.
The database looks like this if you want to create your own.
❤️
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
OK, I ran
and then
npm run build
in theredux-firestore
folder. This commit resolves the issue for me.@will-hart Using
assign
before made things work for this case, but it seemed to be part of what was causing #49 (hence the change tomerge
).I was also planning on having an option of whether or not to merge similar to the
mergeOrdered
option that was just added.Either way, going to revert the usage of merge over assign. I’m going to add a test case that covers what you are describing before attempting other fixes for the merging issues.