Skip to content
New issue

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

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

Already on GitHub? # to your account

WIP: move hasValidData to workoutState and avoid refetching datapoints #510

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

morteako
Copy link
Collaborator

@morteako morteako commented Mar 1, 2025

Seems to work
Haven't actually benchmarked (not sure how tbh 👀)
But my guess is that that query can be a bit intense, and seemed like it was fetched 4 times per second? (at the same time+-)
for some reason.

Here the components that need it, fetch the tracked data only when needed (upload and download, when clicked).
Will probably also reduce the amount of rerenders for these components.

BUT!

This doesnt work for the Map :S
I am not sure, but could one maybe instead change to calculate a % of the route done, and then create x-y points based on that?

@@ -117,7 +112,8 @@ export const DataContextProvider = ({ clockWorker, children }: Props) => {
}, [power, heartRate, cadence]);

const start = React.useCallback(async () => {
if (trackedData.length > 0) {
if (!hasValidData) {
// was this wrong before?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

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

Successfully merging this pull request may close these issues.

1 participant