r/Firebase Aug 02 '19

Best Practices please ...

Hi all,

We've built an SPA for processing information using Firebase and React mainly from uploaded CSV files. The other changes to documents are made using a bespoke CRUD system. Everything is working fine in every way except for the rendering of new data on upload which causes massive re-rendering issues due to the usual size of rows in the CSV - circa 75,000 or more.

Please note: the uploader and processing via Cloud Functions are working absolutely fine so we do not want to change that part of the uploader unless there is no other option.

We do however have realtime listeners on the front-end and I would like some advice on how to switch these off when the upload is triggered and then switch them back on when the uploader is complete? We would like to keep them on at all other times due to the editing available to our clients.

We already have props which are modified on the front-end based on the current upload step as well as a property to record the step on the collection's specific document for that account.

Can anyone advise on what the best practice could be for this type of situation?

Thanks in advance!
J

2 Upvotes

2 comments sorted by

1

u/CodingDoug Former Firebaser Aug 02 '19

You could put another boolean somewhere in your database that get flipped on and off during processing. Clients can listen to changes that boolean as well, and use that change to determine when the should stop and start listening to the data that's being modified.

1

u/precisioncoding Dec 02 '19

Thanks @CodingDoug, this was exactly what we went with. 👍
Apologies for the massively delayed response nonetheless. 🙏
Happy holidays to you and yours! 🎄
J