-
Notifications
You must be signed in to change notification settings - Fork 354
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
Uses UI-lib breadcrumbs #1281
Conversation
</BreadcrumbItem> | ||
); | ||
} | ||
const breadcrumbItems = computed(() => { |
There was a problem hiding this comment.
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;
...
}
There was a problem hiding this comment.
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.
Converted to Draft, so that it's not accidentally merged. I'll need to do improvements in the UI lib first. |
Waiting for https://github.com/redpanda-data/ui/pull/528 to be merged and released. |
Closes https://github.com/redpanda-data/console-enterprise/issues/190
I've consulted this change with @ivpanda, this is the preview:
TODO: Improve UI Lib so that it works better with long names.