Skip to content

Commit

Permalink
[Cloud Security] Fix CSP pages remount (#151283)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanSh authored Feb 16, 2023
1 parent 6a7860b commit 8bf10c4
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions x-pack/plugins/cloud_security_posture/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,21 @@ export class CspPlugin
Component: LazyCspCustomAssets,
});

// Keep as constant to prevent remounts https://github.com/elastic/kibana/issues/146773
const App = (props: CspRouterProps) => (
<KibanaContextProvider services={{ ...core, ...plugins }}>
<RedirectAppLinks coreStart={core}>
<div style={{ width: '100%', height: '100%' }}>
<SetupContext.Provider value={{ isCloudEnabled: this.isCloudEnabled }}>
<CspRouter {...props} />
</SetupContext.Provider>
</div>
</RedirectAppLinks>
</KibanaContextProvider>
);

return {
getCloudSecurityPostureRouter: () => (props: CspRouterProps) =>
(
<KibanaContextProvider services={{ ...core, ...plugins }}>
<RedirectAppLinks coreStart={core}>
<div style={{ width: '100%', height: '100%' }}>
<SetupContext.Provider value={{ isCloudEnabled: this.isCloudEnabled }}>
<CspRouter {...props} />
</SetupContext.Provider>
</div>
</RedirectAppLinks>
</KibanaContextProvider>
),
getCloudSecurityPostureRouter: () => App,
};
}

Expand Down

0 comments on commit 8bf10c4

Please sign in to comment.