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

use-resze-observer impl. #5166

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

Conversation

15Arindam
Copy link

@15Arindam 15Arindam commented Mar 6, 2023

Issue

Charts don't re-size when the window size changes #5141

Description

Implemented use-resize-observer hook for this scenario

Preview

Double check

  • I have tested my parser changes locally with poetry run test_parser "zone_key"
  • I have run pnpx prettier --write . and poetry run format to format my changes.

closes: #5184

Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

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

I have been testing this locally and while the resizing seem to work now, it seems to have broken this code somehow:

const dx = event_.pageX
? event_.pageX - svgNode.getBoundingClientRect().left
: pointer(event_); // TODO: check if this works

I'm not really sure why it broke and have not had the time to dig into it further but until that is fixed we can't merge this as it breaks hovering over (some of) the graphs.

@15Arindam 15Arindam force-pushed the issue-5141 branch 2 times, most recently from 201f487 to ad5a6f7 Compare March 8, 2023 03:59
@netlify
Copy link

netlify bot commented Mar 9, 2023

Deploy Preview for phenomenal-syrniki-c5ceaa ready!

Name Link
🔨 Latest commit 54ed937
🔍 Latest deploy log https://app.netlify.com/sites/phenomenal-syrniki-c5ceaa/deploys/6418bbc5fe9fb500084df0ae
😎 Deploy Preview https://deploy-preview-5166--phenomenal-syrniki-c5ceaa.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 site settings.

@VIKTORVAV99
Copy link
Member

@15Arindam please do not use force push, it makes it impossible to review changes since the last commit.

Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

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

As far as I can tell everything is working as expected now, nice work!

In order for this to pass the CI though you need to run pnpx prettier --write . in the /web folder.

Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

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

There seems to be some inconsistencies with the initial values that need to be corrected and/or explained, this PR is currently not consistent all the way and these seems to be no real need to set an initial value in the first place.

@VIKTORVAV99
Copy link
Member

VIKTORVAV99 commented Mar 13, 2023

@15Arindam I noticed you created a new PR but I would prefer we keep using this one to preserve the discussions and comments in the original PR.

@15Arindam
Copy link
Author

Hi @VIKTORVAV99 , The type value of width, height returned from useResizeObserver hook is undefined | number , methods doesnt' throw typescript error , there I kept as is otherplace I defaulted with zero. But as you pointed out I missed the negative value cases.

@github-actions github-actions bot added parser translations 🗣 zone config Pull request or issue for zone configurations labels Mar 15, 2023
VIKTORVAV99
VIKTORVAV99 previously approved these changes Mar 15, 2023
Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

Thanks for implementing the change!
I'll merge this later today after #5183 is merged to see that the tests are still passing but they should be as I saw no changes that should have affected them.

@VIKTORVAV99
Copy link
Member

@tonypls do you know why cypress is failing in here? As far as I can tell there is no direct changes that should affect the tests.

@tonypls
Copy link
Collaborator

tonypls commented Mar 16, 2023

@tonypls do you know why cypress is failing in here? As far as I can tell there is no direct changes that should affect the tests.

It looks like the resize observer doesn't see the size of the container of the AreaGraph in cypress. The graph just keeps growing so Cypress in unable to hover

@VIKTORVAV99 VIKTORVAV99 removed parser translations 🗣 infrastructure zone config Pull request or issue for zone configurations labels Mar 20, 2023
Copy link
Member

Choose a reason for hiding this comment

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

@tonypls would you mind reviwing the changes to the tests here?
I'm not super familiar with how cypress works 🙂

Copy link
Collaborator

Choose a reason for hiding this comment

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

Damn, looks like there's some sort of loop in the width observer.

Screen.Recording.2023-03-20.at.21.31.18.mov

@VIKTORVAV99 VIKTORVAV99 dismissed their stale review March 20, 2023 15:56

changes have been made since the last review

@VIKTORVAV99 VIKTORVAV99 linked an issue Mar 25, 2023 that may be closed by this pull request
@silkeholmebonnen silkeholmebonnen mentioned this pull request Apr 22, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file frontend 🎨
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Charts don't re-size when the window size changes
3 participants