a-dilettante / HackerBuzz-ReactNative

A Hacker News Reader built in React Native for iOS and Android
MIT License
231 stars 66 forks source link

Adding to Favorites is slow #3

Open deadcoder0904 opened 6 years ago

deadcoder0904 commented 6 years ago

The UI doesn't respond fast enough. It makes you feel slow. I think what you are doing here is first saving to the database & then updating the UI whereas you must do the absolute opposite. First change the UI so it shows that it has been added to favorite & then save it to DB

a-dilettante commented 6 years ago

Do you mean that the issue lies in swiping to favorite?

By the way, feel free to contribute!

benadamstyles commented 6 years ago

@deadcoder0904 I think doing it that way round would be flaky and introduce more surface area for bugs. What if saving to the database fails? You'd have to then change the UI back, which means you'd have to maintain a separate "database" of items that have been swiped but not yet saved.

deadcoder0904 commented 6 years ago

@Leeds-eBooks yaa I thought about it while posting the issue. So I knew the answer, if you're using Realm then it passes a result if database fails. So then you can change the UI & this is likely to be 0.01% of the time. If you've used Meteor you will know it better. Meteor syncs data between client & server using Pub-Sub model. That's how I would do it.

@RCiesielczuk regarding your question. What happens is if I swipe left, the UI updates after 2 seconds. So what I did was I swiped 2-3 times to make it favorite. I think double-tap would be a better option.

Also, can't contribute right now as I am busy making my own RN app 😝 & you're app is huge inspiration. Everything about it is done right.