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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dropdown: Stop Dropdown accepting a function as children #65467

Merged
merged 1 commit into from Apr 4, 2023

Conversation

ashharrison90
Copy link
Contributor

@ashharrison90 ashharrison90 commented Mar 28, 2023

What is this feature?

  • PanelChrome: Implement hover header聽#61774 added a new prop to Dropdown, onVisibleChange
  • this makes the function-as-a-child pattern redundant, as you can instead use the onVisibleChange prop. think using the new prop is clearer/probably more performant. 馃憦
  • removes being able to use a function as a child from Dropdown
  • changes the only place that utilised this (QuickAdd) to use onVisibleChange instead

Why do we need this feature?

  • keep our components tidy

Who is this feature for?

  • me

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.

Release notice breaking change

We've removed the ability for functions to be passed as children to the Dropdown component. Previously, this was used to access the isOpen state of the dropdown. This can be now be achieved with the onVisibleChange prop.

Before:

return (
  <Dropdown overlay={MenuActions} placement="bottom-end">
    {(isOpen) =>
      <ToolbarButton iconOnly icon="plus" isOpen={isOpen} aria-label="New" />
    }
  </Dropdown>
);

After:

const [isOpen, setIsOpen] = useState(false);

...

return (
  <Dropdown overlay={MenuActions} placement="bottom-end" onVisibleChange={setIsOpen}>
    <ToolbarButton iconOnly icon="plus" isOpen={isOpen} aria-label="New" />
  </Dropdown>
);

@ashharrison90 ashharrison90 added type/chore no-backport Skip backport of PR no-changelog Skip including change in changelog/release notes labels Mar 28, 2023
@ashharrison90 ashharrison90 added this to the 9.5.0 milestone Mar 28, 2023
@ashharrison90 ashharrison90 requested a review from a team as a code owner March 28, 2023 15:57
@ashharrison90 ashharrison90 self-assigned this Mar 28, 2023
@ashharrison90 ashharrison90 requested review from tskarhed and yaelleC and removed request for a team March 28, 2023 15:57
@ashharrison90 ashharrison90 changed the title Dropdown: Remove dropdown accepting function children Dropdown: Stop Dropdown accepting function children Mar 28, 2023
@ashharrison90 ashharrison90 changed the title Dropdown: Stop Dropdown accepting function children Dropdown: Stop Dropdown accepting a function as children Mar 28, 2023
@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.

Copy link
Contributor

@joshhunt joshhunt left a comment

Choose a reason for hiding this comment

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

I think we should have a clear deprecation process and follow it even when we don't think it matters. Ignoring the process seems to go against all our goals for helping users upgrade with confidence, and creating a UI library that developers can rely on.

I don't think the cost of keeping this, deprecated, in the Dropdown component is that high.

@ashharrison90
Copy link
Contributor Author

@joshhunt i mean i agree in principle, i just don't think anyone is using this at all 馃槄

so put this in the v10 milestone, add a breaking change label+notice and do it that way then? 馃

@ashharrison90 ashharrison90 modified the milestones: 9.5.0, 10.0.0 Mar 29, 2023
@ashharrison90 ashharrison90 added add to changelog breaking change Relevant for changelog generation and removed no-changelog Skip including change in changelog/release notes labels Mar 29, 2023
@ashharrison90 ashharrison90 merged commit 6f7363a into main Apr 4, 2023
30 checks passed
@ashharrison90 ashharrison90 deleted the ash/tidy-up-dropdown branch April 4, 2023 13:40
VikaCep pushed a commit that referenced this pull request Apr 5, 2023
@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
add to changelog area/frontend breaking change Relevant for changelog generation no-backport Skip backport of PR type/chore
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants