Skip to content

Fix for jumping Calendar Heatmap #291

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

AntonJames-Sistence
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

bug.mov

What is the new behavior?

No more jumping behavior

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Copy link

netlify bot commented Jul 11, 2025

Deploy Preview for reaviz-storybook ready!

Name Link
🔨 Latest commit f7acf99
🔍 Latest deploy log https://app.netlify.com/projects/reaviz-storybook/deploys/6894bb5c4105ad00086a144e
😎 Deploy Preview https://deploy-preview-291--reaviz-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@@ -73,7 +74,17 @@ export const LinearAxis: FC<Partial<LinearAxisProps>> = (props) => {
width: width
});

// Use a ref to track update count to prevent infinite loops
const updateCountRef = useRef(0);
Copy link
Member

Choose a reason for hiding this comment

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

This feels like a odd way to fix it. Whats triggering this to go in a loop?

Copy link
Author

@AntonJames-Sistence AntonJames-Sistence Jul 12, 2025

Choose a reason for hiding this comment

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

useEffect from line 111 and onDimensionsChange

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense but I'm curious what in the heatmap that could be causing this since it seems unique to the heatmap since other charts i've not seen this one.

@amcdnl amcdnl requested review from steppy452 and Copilot July 11, 2025 20:34
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds loop prevention logic to the LinearAxis component to fix the jumping behavior by throttling repeated dimension updates.

  • Introduces a useRef counter to guard against excessive updateDimensions calls
  • Adds reset logic when dependencies change to restart the count for each render cycle

@AntonJames-Sistence
Copy link
Author

I’ve changed the approach for this fix: now we use a MIN_DIMENSION_CHANGE threshold to determine if the difference between dimensions.width and width is large enough to trigger a resize. This ensures we don’t enter an infinite update loop.

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