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

Uses UI-lib breadcrumbs #1281

Merged
merged 4 commits into from
Jun 25, 2024
Merged

Uses UI-lib breadcrumbs #1281

merged 4 commits into from
Jun 25, 2024

Conversation

jvorcak
Copy link
Collaborator

@jvorcak jvorcak commented Jun 11, 2024

Closes https://github.com/redpanda-data/console-enterprise/issues/190

I've consulted this change with @ivpanda, this is the preview:

Screenshot 2024-06-11 at 15 20 41
Screenshot 2024-06-11 at 15 20 51
Screenshot 2024-06-11 at 15 20 58
Screenshot 2024-06-11 at 15 21 07

TODO: Improve UI Lib so that it works better with long names.

Screenshot 2024-06-11 at 15 21 21

@jvorcak jvorcak requested review from weeco and ivpanda June 11, 2024 13:21
@weeco weeco requested a review from rikimaru0345 June 11, 2024 14:04
</BreadcrumbItem>
);
}
const breadcrumbItems = computed(() => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think a computed should be created within an observable component.
Are you sure it won't just always be recreated/recomputed on every render? I think it will...

Instead consider this (outside of a component):

const obj = observable({

    get breadcrumbItems() {
          // compute items here
         return items;
    }
});

const AppPageHeader = observer(() => {
       const items =  obj.breadcrumbItems;
       ...
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I though creating an computed with get() is OK as part of the observable. I think we use the same concept just class-based elsewhere. There is also an example on Mobx site https://mobx.js.org/computeds-with-args.html#2-close-over-the-arguments

But maybe I misunderstand something. I've tried your solution and it seems the number of renders is identical. I'm happpy to chat about this on Slack.

@jvorcak jvorcak marked this pull request as draft June 12, 2024 13:48
@jvorcak jvorcak marked this pull request as draft June 12, 2024 13:48
@jvorcak
Copy link
Collaborator Author

jvorcak commented Jun 12, 2024

Converted to Draft, so that it's not accidentally merged. I'll need to do improvements in the UI lib first.

@jvorcak
Copy link
Collaborator Author

jvorcak commented Jun 13, 2024

Waiting for https://github.com/redpanda-data/ui/pull/528 to be merged and released.

@jvorcak jvorcak marked this pull request as ready for review June 25, 2024 12:17
@jvorcak jvorcak merged commit 2a96a6f into master Jun 25, 2024
6 checks passed
@jvorcak jvorcak deleted the feature/use-ui-library-breadcrumbs branch June 25, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants