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.

Deleting object properties doesn't update the UI since 0.3.1

See original GitHub issue

Do 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

image

and like this for 0.2.8

image

However when deleting items, 0.3.1 has this diff:

image

and 0.2.8 has this diff

image

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.

image

❤️

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
will-hartcommented, Mar 2, 2018

OK, I ran

yarn add https://github.com/prescottprue/redux-firestore.git#c7af296d1f9c503609a01b5eb5950bd2394cffd9

and then npm run build in the redux-firestore folder. This commit resolves the issue for me.

1reaction
prescottpruecommented, Mar 1, 2018

@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 to merge).

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Javascript delete object property not working - Stack Overflow
If the object inherits a property from a prototype, and doesn't have the property itself, the property can't be deleted by referencing the...
Read more >
delete operator - JavaScript - MDN Web Docs - Mozilla
The delete operator removes a property from an object. If the property's value is an object and there are no more references to...
Read more >
Release notes & updates – Azure CLI - Microsoft Learn
Learn about the latest Azure Command-Line Interface (CLI) release notes and updates for both the current and beta versions of the CLI.
Read more >
Fix list for IBM WebSphere Application Server traditional V9
IBM WebSphere Application Server traditional provides periodic fixes for the base and Network Deployment editions of release V9. The following is a complete ......
Read more >
Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug:1523 - "[IDEA] Offload work by distributing trivial ebuild maintenance to users, introduce a simple stability voting system and have a core team...
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