mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[Lens] Chart is not updating with Refresh button (#114135)
This commit is contained in:
parent
136eafe5a7
commit
f50345f8ef
2 changed files with 27 additions and 3 deletions
|
@ -1142,6 +1142,27 @@ describe('Lens App', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('dispatches update to searchSessionId and dateRange when the user hits refresh', async () => {
|
||||
const { instance, services, lensStore } = await mountWith({});
|
||||
act(() =>
|
||||
instance.find(services.navigation.ui.TopNavMenu).prop('onQuerySubmit')!({
|
||||
dateRange: { from: 'now-7d', to: 'now' },
|
||||
})
|
||||
);
|
||||
|
||||
instance.update();
|
||||
expect(lensStore.dispatch).toHaveBeenCalledWith({
|
||||
type: 'lens/setState',
|
||||
payload: {
|
||||
resolvedDateRange: {
|
||||
fromDate: '2021-01-10T04:00:00.000Z',
|
||||
toDate: '2021-01-10T08:00:00.000Z',
|
||||
},
|
||||
searchSessionId: 'sessionId-2',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('updates the state if session id changes from the outside', async () => {
|
||||
const sessionIdS = new Subject<string>();
|
||||
const services = makeDefaultServices(sessionIdS, 'sessionId-1');
|
||||
|
|
|
@ -27,7 +27,7 @@ import {
|
|||
LensAppState,
|
||||
DispatchSetState,
|
||||
} from '../state_management';
|
||||
import { getIndexPatternsObjects, getIndexPatternsIds } from '../utils';
|
||||
import { getIndexPatternsObjects, getIndexPatternsIds, getResolvedDateRange } from '../utils';
|
||||
|
||||
function getLensTopNavConfig(options: {
|
||||
showSaveAndReturn: boolean;
|
||||
|
@ -363,8 +363,11 @@ export const LensTopNavMenu = ({
|
|||
trackUiEvent('app_date_change');
|
||||
} else {
|
||||
// Query has changed, renew the session id.
|
||||
// Time change will be picked up by the time subscription
|
||||
dispatchSetState({ searchSessionId: data.search.session.start() });
|
||||
// recalculate resolvedDateRange (relevant for relative time range)
|
||||
dispatchSetState({
|
||||
searchSessionId: data.search.session.start(),
|
||||
resolvedDateRange: getResolvedDateRange(data.query.timefilter.timefilter),
|
||||
});
|
||||
trackUiEvent('app_query_change');
|
||||
}
|
||||
if (newQuery) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue