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

Menu item small refactor #492

Merged
merged 4 commits into from
Jan 27, 2022
Merged

Conversation

laviomri
Copy link
Contributor

Small refactor, no actual change - mostly prettier. I split it to avoid big PRs.

@@ -22,7 +22,6 @@ export default function useMenuKeyboardNavigation(
setActiveItemIndex,
isVisible,
ref,
resetOpenSubMenuIndex,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's unused

@@ -1,5 +1,5 @@
/* eslint-disable react/jsx-props-no-spreading */
import React, { useCallback, useRef, useLayoutEffect, useMemo, useEffect } from "react";
import React, { useCallback, useRef, useLayoutEffect, useMemo, useEffect, forwardRef } from "react";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added forwardRef, and applied the prettier fixes

@@ -22,7 +22,6 @@ export default function useMenuKeyboardNavigation(
setActiveItemIndex,
isVisible,
ref,
resetOpenSubMenuIndex,
Copy link
Contributor

Choose a reason for hiding this comment

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

you can't remove it since it is not an object (it is in method params)
@sahariko

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure I understood you - there's only one place that references this function (in Menu.jsx), and I removed it too in this PR.. where do you think this may still be used?

Copy link
Contributor

@sahariko sahariko Jan 26, 2022

Choose a reason for hiding this comment

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

If this hook is somehow used outside of this package, this would be considered a breaking change, resulting in a major version bump.

Unless we're 100% sure there's no outside usage, I think that we can create a milestone and aggregate all of these breaking changes, but for now let's hold back on this.

Copy link
Contributor Author

@laviomri laviomri Jan 26, 2022

Choose a reason for hiding this comment

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

I'm not 100% (I don't think we can be 100% sure).
It is however a highly internal hook for the menu component, which isn't exposed directly from the package. If someone external imports this hook directly (e.g. require("dist/src/components....."), should we avoid changing it?

I have no problem with reverting this change if needed, but I'm pretty sure I'm missing something :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm good point, I think we can make this change then 🙂

@laviomri laviomri merged commit b4a48b3 into master Jan 27, 2022
@laviomri laviomri deleted the chore/omri/menu-item-small-refactor branch January 27, 2022 07:17
@laviomri laviomri mentioned this pull request Jan 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants