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

DEVPROD-13581 bump @leafygreen-ui/tabs from 11.2.0 to 13.1.1 and refactor tab logic #521

Merged
merged 60 commits into from
Dec 27, 2024

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Nov 25, 2024

Bumps @leafygreen-ui/tabs from 11.2.0 to 13.1.1.

Release notes

Sourced from @​leafygreen-ui/tabs's releases.

@​leafygreen-ui/tabs@​13.1.1

Patch Changes

  • bca3969cf: Removes incorrect setSelectedd prop. setSelected is the correct prop.

@​leafygreen-ui/tabs@​13.1.0

Minor Changes

  • 30f111498: LG-4473 Updates the selected and setSelected props to accept both strings and numbers. The string must match the text content from the name prop on the Tab component.

      const [selectedTab, setSelectedTab] = useState<string | number>('Tab 4');
    return (
    <div>
    <Button onClick={() => setSelectedTab('Tab 2')}>
    Set second tab as active
    </Button>
    <Tabs
    selected={selectedTab}
    setSelected={setSelectedTab}
    >
    <Tab name="Tab 1">
    Content 1
    </Tab>
    <Tab name="Tab 2">
    Content 2
    </Tab>
    <Tab name="Tab 3">
    Content 3
    </Tab>
    <Tab name="Tab 4">
    Content 4
    </Tab>
    <Tabs>
    </div>
    );

Patch Changes

  • Updated dependencies [9776f5f42]
    • @​leafygreen-ui/hooks@​8.2.0

@​leafygreen-ui/tabs@​13.0.1

Patch Changes

  • e7bc12814: Adds more thorough test coverage for disabled inputs
  • Updated dependencies [c1b8b633b]
  • Updated dependencies [fe2483937]

... (truncated)

Commits

Dependabot compatibility score

You can trigger a rebase of this PR by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Note
Automatic rebases have been disabled on this pull request as it has been open for over 30 days.

Bumps [@leafygreen-ui/tabs](https://github.com/mongodb/leafygreen-ui) from 11.2.0 to 13.1.1.
- [Release notes](https://github.com/mongodb/leafygreen-ui/releases)
- [Commits](https://github.com/mongodb/leafygreen-ui/compare/@leafygreen-ui/tabs@11.2.0...@leafygreen-ui/tabs@13.1.1)

---
updated-dependencies:
- dependency-name: "@leafygreen-ui/tabs"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot requested a review from a team as a code owner November 25, 2024 18:29
@dependabot dependabot bot added the dependencies Pull requests that update a dependency file label Nov 25, 2024
@dependabot dependabot bot requested a review from khelif96 November 25, 2024 18:29
@khelif96
Copy link
Contributor

khelif96 commented Dec 2, 2024

This is delayed on https://jira.mongodb.org/browse/LG-4696 I'll get to it once they release a fix

@khelif96 khelif96 removed the request for review from a team December 2, 2024 17:25
@khelif96 khelif96 changed the title CHORE(NPM) - bump @leafygreen-ui/tabs from 11.2.0 to 13.1.1 DEVPROD-13581 bump @leafygreen-ui/tabs from 11.2.0 to 13.1.1 and refactor tab logic Dec 17, 2024
@khelif96 khelif96 requested a review from minnakt December 18, 2024 19:06
if (!urlTab || !tabToIndexMap[urlTab]) {
setSelectedTab(ConfigurePatchPageTabs.Tasks);
}
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. fix eslint warning either by adding comment or dependencies

Comment on lines 80 to 89
useTabShortcut({
currentTab: selectedTab,
currentTab: tabToIndexMap[state.selectedTab],
numTabs: indexToTabMap.length,
setSelectedTab,
setSelectedTab: (i: number) => setSelectedTab(indexToTabMap[i]),
});

// Handle redirecting to the correct tab if the tab is not active
useEffect(() => {
if (!urlTab || !tabToIndexMap[urlTab]) {
setSelectedTab(ConfigurePatchPageTabs.Tasks);
Copy link
Contributor

Choose a reason for hiding this comment

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

could we group these hooks all together just for organizational purposes? (i.e. put the hooks first, then put the set functions after)

if (!validateObjectId(patchId)) {
// @ts-expect-error: FIXME. This comment was added by an automated script.
return <Navigate to={getVersionRoute(patchId)} />;
if (!validateObjectId(patchId || "")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we extract this function call and use it both here and on L26 i.e.

const isMainlineVersion = !validateObjectId(patchId || "")

Comment on lines +207 to +208
if (sendAnalytics) {
sendEvent({ name: "Changed tab", tab: newTab });
Copy link
Contributor

Choose a reason for hiding this comment

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

does this ever get called? It seems like whenever we're calling the handleTabChange function in this file, sendAnalytics is false

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks fixed!

}
`;
` as ComponentType<TabsProps>;
Copy link
Contributor

Choose a reason for hiding this comment

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

is the as ComponentType<TabsProps> necessary?

I think we may also want to respond on LG-4696. I think the typing of setSelected seems to be funky, not sure why they prescribe using Dispatch<SetStateAction<number>> and not a more flexible implementation

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes it is to get it to work well with Emotion. I left a comment on the slack thread irt the weird Dispatch<SetState... typing but I also followed up on the ticket

navigate(getVersionRoute(versionId), { replace: true });
const handleTabChange = (
newTab: VersionPageTabs,
sendAnalytics: boolean = false,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it makes sense to make it a required parameter since the argument is always being provided

Suggested change
sendAnalytics: boolean = false,
sendAnalytics: boolean,

@khelif96 khelif96 enabled auto-merge (squash) December 26, 2024 21:33
@khelif96 khelif96 merged commit a6634f6 into main Dec 27, 2024
6 checks passed
@khelif96 khelif96 deleted the dependabot/npm_and_yarn/leafygreen-ui/tabs-13.1.1 branch December 27, 2024 19:14
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 spruce
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants