Home > Software engineering >  How would I update the list of items when 1 item is changed by the user in next screen and comes bac
How would I update the list of items when 1 item is changed by the user in next screen and comes bac

Time:12-20

I have a list of items on 1 screen of a mobile app ( android/ios). All the items are in 1 document in Firestore. The user clicks one of the items and moves to the next screen with item detail. The user makes some changes on the screen and saves. Now the user needs to be presented with the original items list screen. Now should I again fetch all the items from Firestore since 1 item is changed? Users may change several items 1 by 1. In this way, for every item change, I need to fetch the document again and again.

CodePudding user response:

If all your items are stored in a single document, to see the changes that are made in real-time, then you should listen for real-time updates. In this way, you don't have to fetch the document again and again.

When using real-time listeners, don't also forget to detach them, once are not needed anymore.

  • Related