Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web UI crashes when large collection updated via API #176

Open
petermenocal opened this issue Jul 22, 2021 · 3 comments
Open

Web UI crashes when large collection updated via API #176

petermenocal opened this issue Jul 22, 2021 · 3 comments

Comments

@petermenocal
Copy link

When using the JS SDK to update a large number of collection items, the web UI at app.flamelink.io will completely crash and freeze. Experience has been repeatable in both Safari and Firefox on MacOS.

I've attached a video of the behavior. In this clip, you'll see the interface responsive, the API request sent, and finally the interface frozen.

Steps to reproduce:

  • Create a collection with a large-ish number of items (around 800 were contained in the collection in question)
  • Log into the web ui at app.flamelink.io and open your list of items
  • Update each of those collection items via the API
  • Web UI will now be completely inoperable for all logged in users.

This is presumably happening because the entire list of items is loaded into that paginated table and listened to with the realtime subscriber. Is there a way we can disable this somehow to increase performance for large collections that get updated?

Video of issue:
https://user-images.githubusercontent.com/22479535/126672010-e4775b96-57b8-46ac-b054-e5f22d2da26b.mov

@gitdubz
Copy link
Contributor

gitdubz commented Jul 22, 2021

Hi,

For large collection updates does the same happen when doing updates using batch updates?
https://firebase.google.com/docs/firestore/manage-data/transactions#web-v8_2

@gitdubz gitdubz transferred this issue from flamelink/flamelink Jul 22, 2021
@petermenocal
Copy link
Author

I'm using the real-time database which I don't believe has batched updates like Firestore.

@gitdubz
Copy link
Contributor

gitdubz commented Jul 22, 2021

Ah okay. So on our end, how we handle large collection updates for RTDB is to only update the app state (referring to react & redux) when the last item in the list of updates is done. This way the UI does not do 800 re-renders, it only does 1.

This is however not controllable via the SDK/API since the app will respond to each update as if it is not a bulk operation.

The only way this can potentially be achieved is if a bulk operation is provided on the SDK which would take all the updates and apply it as 1 single update to the RTDB object.

You could do this yourself using the raw Firebase functionality.
https://firebase.google.com/docs/database/web/read-and-write#update_specific_fields

firebaseApp
  .database()
  .ref('flamelink/environments/production/content/schemaKey/en-US')
  .update({ 
    '1234567890': { 
      __meta__: { 
        lastModifiedBy: 'yourUserId', 
        lastModifiedData: new Date().toISOString() 
      }, 
      ... 
    },
    '0987654321': { ... }
  })

NOTE: You would need to handle the lastModifiedBy and lastModifiedDate values

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants