Skip to content

Commit

Permalink
Enterprise Search: pass isSidebarEnabled by value instead of a get fu…
Browse files Browse the repository at this point in the history
…nction
  • Loading branch information
TattdCodeMonkey committed Mar 6, 2023
1 parent 773a372 commit eeef257
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ export const renderApp = (
params,
core,
plugins,
getIsSidebarEnabled,
isSidebarEnabled,
}: {
params: AppMountParameters;
core: CoreStart;
plugins: PluginsStart;
getIsSidebarEnabled: () => boolean;
isSidebarEnabled: boolean;
},
{ config, data }: { config: ClientConfigType; data: ClientData }
) => {
Expand Down Expand Up @@ -74,7 +74,7 @@ export const renderApp = (
charts: plugins.charts,
cloud: plugins.cloud,
uiSettings: core.uiSettings,
getIsSidebarEnabled,
isSidebarEnabled,
guidedOnboarding: plugins.guidedOnboarding,
history: params.history,
navigateToUrl: core.application.navigateToUrl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface KibanaLogicProps {
application: ApplicationStart;
config: { host?: string };
productAccess: ProductAccess;
getIsSidebarEnabled: () => boolean;
isSidebarEnabled: boolean;
// Kibana core
capabilities: Capabilities;
history: ScopedHistory;
Expand All @@ -54,7 +54,6 @@ interface KibanaLogicProps {
export interface KibanaValues extends Omit<KibanaLogicProps, 'cloud'> {
cloud: Partial<CloudSetup>;
isCloud: boolean;
isSidebarEnabled: boolean;
navigateToUrl(path: string, options?: CreateHrefOptions): Promise<void>;
}

Expand All @@ -66,9 +65,9 @@ export const KibanaLogic = kea<MakeLogicType<KibanaValues>>({
config: [props.config || {}, {}],
charts: [props.charts, {}],
cloud: [props.cloud || {}, {}],
getIsSidebarEnabled: [props.getIsSidebarEnabled, {}],
guidedOnboarding: [props.guidedOnboarding, {}],
history: [props.history, {}],
isSidebarEnabled: [props.isSidebarEnabled, {}],
navigateToUrl: [
(url: string, options?: CreateHrefOptions) => {
const deps = { history: props.history, http: HttpLogic.values.http };
Expand All @@ -87,10 +86,6 @@ export const KibanaLogic = kea<MakeLogicType<KibanaValues>>({
}),
selectors: ({ selectors }) => ({
isCloud: [() => [selectors.cloud], (cloud?: Partial<CloudSetup>) => !!cloud?.isCloudEnabled],
isSidebarEnabled: [
() => [selectors.getIsSidebarEnabled],
(getIsSidebarEnabled: () => boolean) => getIsSidebarEnabled(),
],
}),
});

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class EnterpriseSearchPlugin implements Plugin {
: undefined;
const plugins = { ...pluginsStart, cloud } as PluginsStart;

return { params, core: coreStart, plugins, getIsSidebarEnabled: () => this.isSidebarEnabled };
return { params, core: coreStart, plugins, isSidebarEnabled: this.isSidebarEnabled };
}

private getPluginData() {
Expand Down

0 comments on commit eeef257

Please sign in to comment.