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): ordered collection is not updating if using orderBy with desc

See original GitHub issue

What is the current behavior?

I connect to Firestore like this

firestoreConnect([
    {
        collection: 'emotions',
        orderBy: ['updateDate', 'desc'],
    },
]),

then I open the screen with collection and collections are ordered by updateDate (desc). Then if I update a record

newRecord.updateDate = new Date()

firestore
    .collection('emotions')
    .doc(record.id)
    .update({ ...newRecord })

all content of the record will be updated, but not the order

Screen Shot 2019-09-18 at 15 39 14

If I go back and open screen again, everything is ordered fine again.

Screen Shot 2019-09-18 at 15 46 22

But order works fine if I use orderBy with asc instead of desc

What is the expected behavior? Should update collection order correctly according to it index

Which version of redux-firestore are you using? What about other dependencies? “redux-firestore”: “^0.9.0”, “react-redux-firebase”: “^2.4.1”, “react-native”: “0.59.10”,

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gotdibbscommented, Mar 14, 2020

@prescottprue I think I just reproduced this issue in my own app. I’ve whipped up a sample here: https://codesandbox.io/s/firestore-sort-demo-3izym (relevant code is in components\Sort\Sort.js. Sorry in advance for the ugliness of my quick hack job, but hopefully it gets the point across.

If you click the button a few times to swap data at indices 0 and 1, you’ll see how the ordered data gets a bit messy in memory.

I’ll try to carve out some time to dig further into this soon myself though, but if you have any thoughts that’d be greatly appreciated.

0reactions
sintylapsecommented, Dec 6, 2019

Hi, sorry, don’t have a time right now. Is it okay if I request reopening this issue if I will be able to reproduce it again and will create reproduction example?

Read more comments on GitHub >

github_iconTop Results From Across the Web

orderByDesc or orderBy does not work in Client Scr...
Hello All, I received the error below when tried to modify "u_affected_user" field which leads "cmdb_ci" modifying due to Client.
Read more >
ORDER BY DESC is not working right
Nothing's preventing you from loading to a temp-file first, then casting when going to the final destination. Numeric data should be stored in...
Read more >
OrderBy query result is not ordered from cosmos db ...
Once I update a few documents from the result set , those are not part of the result set when I run the...
Read more >
ORDER BY clause | Couchbase Docs
The ORDER BY clause sorts the result-set by one or more columns, in ascending or descending order.
Read more >
SQL ORDER BY Keyword
The ORDER BY keyword is used to sort the result-set in ascending or descending order. ... To sort the records in descending order,...
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