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

PanelHeaderMenuTrigger: Store clickCoordinates in a ref instead of state #65601

Merged
merged 1 commit into from
Apr 11, 2023

Conversation

ashharrison90
Copy link
Contributor

What is this feature?

  • prereq for Chore: Upgrade to react 18 #64428
  • rewrites PanelHeaderMenuTrigger code to correctly detect click vs. drag behaviour in react 18
    • the main difference here is storing the initial click coordinates in a ref instead of state.
    • probably due to batched updates in react 18, the state wasn't updated between mouseDown and onClick. using a ref ensures it's always up-to-date.

Why do we need this feature?

  • so this code works properly in react 18

Who is this feature for?

  • everyone!

Which issue(s) does this PR fix?:

Fixes #

Special notes for your reviewer:

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.
  • There are no known compatibility issues with older supported versions of Grafana, or plugins.
  • It passes the Hosted Grafana feature readiness review for observability, scalability, performance, and security.

@ashharrison90 ashharrison90 added type/chore no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Mar 30, 2023
@ashharrison90 ashharrison90 added this to the 9.5.0 milestone Mar 30, 2023
@ashharrison90 ashharrison90 requested a review from a team as a code owner March 30, 2023 10:16
@ashharrison90 ashharrison90 requested review from dprokop and ivanortegaalba and removed request for a team March 30, 2023 10:17
@github-advanced-security
Copy link

You have successfully added a new CodeQL configuration .github/workflows/pr-codeql-analysis-javascript.yml:analyze. As part of the setup process, we have scanned this repository and found 27 existing alerts. Please check the repository Security tab to see all alerts.

@grafanabot grafanabot removed this from the 9.5.0 milestone Apr 4, 2023
@grafanabot
Copy link
Contributor

This pull request was removed from the 9.5.0 milestone because 9.5.0 is currently being released.

@ashharrison90 ashharrison90 added this to the 10.0.0 milestone Apr 4, 2023
Copy link
Member

@dprokop dprokop left a comment

Choose a reason for hiding this comment

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

Works as expected.

@ashharrison90 ashharrison90 merged commit 1d0e74f into main Apr 11, 2023
@ashharrison90 ashharrison90 deleted the ash/panel-header-menu-trigger branch April 11, 2023 08:08
alexmobo pushed a commit that referenced this pull request Apr 14, 2023
…state (#65601)

rewrite panelheadermenutrigger to use ref instead of state
@zerok zerok modified the milestones: 10.0.0, 10.0.0-preview May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes type/chore
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

4 participants