All,
I’ve got grocery lists in Firebase. Eventually the lists will be shared, meaning multiple users might be making changes to the same list at once. (Different lists are no issue, but I’m thinking about my husband and I simultaneously assembling our grocery list.)
I’m using cloned blocks to display the list, so there’s not an automatic refresh like with dataviewer and listviewer. I see two options:
-
Every so often, recreate the whole set of cloned rows from fresh data. (That could be on a timer, or could be user triggered.) That’s simple and uses the code I already wrote for setting up the page to begin with. The list loading time is not too bad for first getting to the page, but I’m thinking it’s just slow enough to be annoying for a user actively working on the list. [Actually, I could trigger it with a listener - that’d be better.]
-
Do something clever. I thought I’d use a listener, but it looks like the listener returns the key it’s listening to and the FULL data under that key, not just the changed values (bummer), so I’d need to add a whole lot of listeners. Like 50 of them, if I’m watching each current item for changes.? I guess I’ll have to try that and see if there’s a performance hit. But then I also need to know if a new item has been added to the list, so I’m back to having to watch the whole list anyway. So maybe the listener just watches the list for changes and then I iterate through my cloned components to figure out what to change.
Thoughts? Input? Better option #3 that I’m not thinking of?