[Lens] Avoid suggestion rendering and evaluation on fullscreen mode (#102757)
This commit is contained in:
parent
1315521760
commit
7733950bde
3 changed files with 55 additions and 4 deletions
|
@ -1370,6 +1370,57 @@ describe('editor_frame', () => {
|
|||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('should avoid completely to compute suggestion when in fullscreen mode', async () => {
|
||||
const props = {
|
||||
...getDefaultProps(),
|
||||
initialContext: {
|
||||
indexPatternId: '1',
|
||||
fieldName: 'test',
|
||||
},
|
||||
visualizationMap: {
|
||||
testVis: mockVisualization,
|
||||
},
|
||||
datasourceMap: {
|
||||
testDatasource: mockDatasource,
|
||||
testDatasource2: mockDatasource2,
|
||||
},
|
||||
|
||||
ExpressionRenderer: expressionRendererMock,
|
||||
};
|
||||
|
||||
const { instance: el } = await mountWithProvider(
|
||||
<EditorFrame {...props} />,
|
||||
props.plugins.data
|
||||
);
|
||||
instance = el;
|
||||
|
||||
expect(
|
||||
instance.find(FrameLayout).prop('suggestionsPanel') as ReactElement
|
||||
).not.toBeUndefined();
|
||||
|
||||
await act(async () => {
|
||||
(instance.find(FrameLayout).prop('dataPanel') as ReactElement)!.props.dispatch({
|
||||
type: 'TOGGLE_FULLSCREEN',
|
||||
});
|
||||
});
|
||||
|
||||
instance.update();
|
||||
|
||||
expect(instance.find(FrameLayout).prop('suggestionsPanel') as ReactElement).toBe(false);
|
||||
|
||||
await act(async () => {
|
||||
(instance.find(FrameLayout).prop('dataPanel') as ReactElement)!.props.dispatch({
|
||||
type: 'TOGGLE_FULLSCREEN',
|
||||
});
|
||||
});
|
||||
|
||||
instance.update();
|
||||
|
||||
expect(
|
||||
instance.find(FrameLayout).prop('suggestionsPanel') as ReactElement
|
||||
).not.toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('passing state back to the caller', () => {
|
||||
|
|
|
@ -452,7 +452,8 @@ export function EditorFrame(props: EditorFrameProps) {
|
|||
)
|
||||
}
|
||||
suggestionsPanel={
|
||||
allLoaded && (
|
||||
allLoaded &&
|
||||
!state.isFullscreenDatasource && (
|
||||
<SuggestionPanel
|
||||
frame={framePublicAPI}
|
||||
activeDatasourceId={state.activeDatasourceId}
|
||||
|
|
|
@ -88,9 +88,8 @@ a tilemap in an iframe: https://github.com/elastic/kibana/issues/16457 */
|
|||
position: relative;
|
||||
}
|
||||
|
||||
.lnsFrameLayout-isFullscreen .lnsFrameLayout__sidebar--left,
|
||||
.lnsFrameLayout-isFullscreen .lnsFrameLayout__suggestionPanel {
|
||||
// Hide the datapanel and suggestions in fullscreen mode. Using display: none does trigger
|
||||
.lnsFrameLayout-isFullscreen .lnsFrameLayout__sidebar--left {
|
||||
// Hide the datapanel in fullscreen mode. Using display: none does trigger
|
||||
// a rerender when the container becomes visible again, maybe pushing offscreen is better
|
||||
display: none;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue