-
Notifications
You must be signed in to change notification settings - Fork 288
Yield while parsing data so that the UI isn't blocked while loading larger shapes #3540
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
base: main
Are you sure you want to change the base?
Yield while parsing data so that the UI isn't blocked while loading larger shapes #3540
Conversation
…hapes Add async parsing methods that yield to the main thread periodically, preventing the UI from becoming unresponsive when syncing shapes with many rows. - Add yieldToMain() utility that uses scheduler.yield() when available, falling back to setTimeout(0) - Add parseAsync() and parseSnapshotDataAsync() methods to MessageParser that yield every 1000 messages by default - Update ShapeStream to always use async parsing for long-poll responses and snapshots - Export yieldToMain and DEFAULT_YIELD_EVERY for users who need custom yielding in their own processing code
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #3540 +/- ##
===========================================
- Coverage 75.24% 61.64% -13.61%
===========================================
Files 51 40 -11
Lines 2743 1559 -1184
Branches 404 106 -298
===========================================
- Hits 2064 961 -1103
+ Misses 677 597 -80
+ Partials 2 1 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
commit: |
- Remove flaky timing assertion in yield test that assumed specific setTimeout ordering - Run prettier on modified files
- Add yield test for parseAsync to improve coverage (was only testing parseSnapshotDataAsync yields) - Fix globalThis guard order in yieldToMain - move typeof check before assignment to avoid reference errors in exotic environments
Remove the yieldEvery parameter from parseAsync and parseSnapshotDataAsync methods - yield interval is now fixed at 1000 messages internally. This simplifies the API; configurability can be added later if users need it. - Remove yieldEvery parameter from async parsing methods - Remove DEFAULT_YIELD_EVERY from public exports - Update tests to work with fixed yield interval
Add async parsing methods that yield to the main thread periodically, preventing the UI from becoming unresponsive when syncing shapes with many rows.