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

Display LoadingIndicator when fetching points data #29

Merged
merged 1 commit into from
Feb 22, 2024

Conversation

aganders3
Copy link
Collaborator

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.

loading-indicator

Copy link

vercel bot commented Feb 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
points-web-viewer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2024 6:31pm

src/scene.tsx Show resolved Hide resolved
Comment on lines +100 to +118
// show a loading indicator if the fetch takes longer than 10ms (avoid flicker)
const loadingTimer = setTimeout(() => setLoading(true), 10);
Copy link
Collaborator Author

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

@andy-sweet andy-sweet left a 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?

@aganders3
Copy link
Collaborator Author

Thanks - I will merge as-is and create a couple issues: one for playback flicker, and one for a similar indicator when loading tracks.

@aganders3 aganders3 merged commit 6f82274 into main Feb 22, 2024
3 checks passed
@aganders3 aganders3 deleted the loading-indicator branch February 22, 2024 01:31
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

Successfully merging this pull request may close these issues.

2 participants