Skip to content

Commit

Permalink
[Search Application] Fix doc link in navigation toolbar (#158203)
Browse files Browse the repository at this point in the history
- Fix the way of using setActionMenu. According their doc and source
code we need to call it twice, for moun and unmount.
- Fix redirection issue and using reactDom in rendering of action items

<img width="926" alt="image"
src="https://github.com/elastic/kibana/assets/17390745/1e531299-e055-4af1-8ec7-92511e1a6e81">
  • Loading branch information
yansavitski authored May 23, 2023
1 parent 8e0123e commit 1b0a1ec
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { useEffect } from 'react';
import React, { useEffect, useLayoutEffect } from 'react';
import { useParams, Redirect, Switch } from 'react-router-dom';

import { useValues, useActions } from 'kea';
Expand Down Expand Up @@ -48,9 +48,16 @@ export const EngineView: React.FC = () => {
}>();
const { renderHeaderActions } = useValues(KibanaLogic);

useLayoutEffect(() => {
renderHeaderActions(EngineHeaderDocsAction);

return () => {
renderHeaderActions();
};
}, []);

useEffect(() => {
fetchEngine({ engineName });
renderHeaderActions(EngineHeaderDocsAction);
}, [engineName]);

if (fetchEngineApiStatus === Status.ERROR) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ export const renderApp = (
productAccess,
productFeatures,
renderHeaderActions: (HeaderActions) =>
params.setHeaderActionMenu((el) => renderHeaderActions(HeaderActions, store, el)),
params.setHeaderActionMenu(
HeaderActions ? renderHeaderActions.bind(null, HeaderActions, store) : undefined
),
security,
setBreadcrumbs: chrome.setBreadcrumbs,
setChromeIsVisible: chrome.setIsVisible,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interface KibanaLogicProps {
navigateToUrl: RequiredFieldsOnly<ApplicationStart['navigateToUrl']>;
productAccess: ProductAccess;
productFeatures: ProductFeatures;
renderHeaderActions(HeaderActions: FC): void;
renderHeaderActions(HeaderActions?: FC): void;
security: SecurityPluginStart;
setBreadcrumbs(crumbs: ChromeBreadcrumb[]): void;
setChromeIsVisible(isVisible: boolean): void;
Expand Down

0 comments on commit 1b0a1ec

Please sign in to comment.