-
Notifications
You must be signed in to change notification settings - Fork 1
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
Display LoadingIndicator when fetching points data #29
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
// show a loading indicator if the fetch takes longer than 10ms (avoid flicker) | ||
const loadingTimer = setTimeout(() => setLoading(true), 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly works, but we might want to fine-tune the time here. My thought is that it should show if dropping frames in Play
mode, so maybe the timeout should be related to the framerate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good for enough for now.
By framerate, you mean framerate of the three.js animation loop? Any idea how to get that easily?
I found stats.js, which looks quite nice with some other things that might be nice to surface easily (though maybe chrome dev tools are sufficient). But we could just time the animation loop ourselves instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By framerate I meant the FPS set by the timer/interval used by the "Play" button, but you raise a good point. I think there are a few places where we're blocking the main thread and you can see the animation loop stall. I've seen this while adding tracks when "Spin" is on. Maybe we need another indicator for that. The little stats.js looks neat - I've seen that in some of the examples. It probably makes sense to include for debugging at least.
rebase on main
3d7f612
to
61bf8fb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. And for people with slow connections, this provides very useful information, so let's get it in (even with the playback flicker).
Can you create an issue to track the playback flicker?
Thanks - I will merge as-is and create a couple issues: one for playback flicker, and one for a similar indicator when loading tracks. |
This adds a LoadingIndicator below the canvas that displays when fetching new points.
I think the same approach can be taken when fetching tracks (maybe a separate indicator?), but that can wait until after track-loading is merged.