Commit 4b043492 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Reset pagination when switching pages

parent 5342e061
...@@ -144,7 +144,7 @@ export default { ...@@ -144,7 +144,7 @@ export default {
this.setDefaultSelectedStage(); this.setDefaultSelectedStage();
} else { } else {
this.setSelectedStage(stage); this.setSelectedStage(stage);
this.fetchStageData(stage.slug); this.updateStageTablePagination({ ...this.pagination, page: 1 });
} }
}, },
onHandleUpdatePagination(data) { onHandleUpdatePagination(data) {
......
...@@ -30,10 +30,7 @@ export const setFeatureFlags = ({ commit }, featureFlags) => ...@@ -30,10 +30,7 @@ export const setFeatureFlags = ({ commit }, featureFlags) =>
export const setSelectedProjects = ({ commit }, projects) => export const setSelectedProjects = ({ commit }, projects) =>
commit(types.SET_SELECTED_PROJECTS, projects); commit(types.SET_SELECTED_PROJECTS, projects);
export const setSelectedStage = ({ commit, getters: { paginationParams } }, stage) => { export const setSelectedStage = ({ commit }, stage) => commit(types.SET_SELECTED_STAGE, stage);
commit(types.SET_SELECTED_STAGE, stage);
commit(types.SET_PAGINATION, { ...paginationParams, hasNextPage: null });
};
export const setDateRange = ( export const setDateRange = (
{ commit, dispatch, getters: { isOverviewStageSelected }, state: { selectedStage } }, { commit, dispatch, getters: { isOverviewStageSelected }, state: { selectedStage } },
......
...@@ -11,10 +11,6 @@ import PathNavigation from 'ee/analytics/cycle_analytics/components/path_navigat ...@@ -11,10 +11,6 @@ import PathNavigation from 'ee/analytics/cycle_analytics/components/path_navigat
import StageTableNew from 'ee/analytics/cycle_analytics/components/stage_table_new.vue'; import StageTableNew from 'ee/analytics/cycle_analytics/components/stage_table_new.vue';
import TypeOfWorkCharts from 'ee/analytics/cycle_analytics/components/type_of_work_charts.vue'; import TypeOfWorkCharts from 'ee/analytics/cycle_analytics/components/type_of_work_charts.vue';
import ValueStreamSelect from 'ee/analytics/cycle_analytics/components/value_stream_select.vue'; import ValueStreamSelect from 'ee/analytics/cycle_analytics/components/value_stream_select.vue';
import {
PAGINATION_SORT_FIELD_END_EVENT,
PAGINATION_SORT_DIRECTION_DESC,
} from 'ee/analytics/cycle_analytics/constants';
import createStore from 'ee/analytics/cycle_analytics/store'; import createStore from 'ee/analytics/cycle_analytics/store';
import Daterange from 'ee/analytics/shared/components/daterange.vue'; import Daterange from 'ee/analytics/shared/components/daterange.vue';
import ProjectsDropdownFilter from 'ee/analytics/shared/components/projects_dropdown_filter.vue'; import ProjectsDropdownFilter from 'ee/analytics/shared/components/projects_dropdown_filter.vue';
......
...@@ -92,12 +92,10 @@ describe('Value Stream Analytics actions', () => { ...@@ -92,12 +92,10 @@ describe('Value Stream Analytics actions', () => {
describe('setSelectedStage', () => { describe('setSelectedStage', () => {
const data = { id: 'someStageId' }; const data = { id: 'someStageId' };
const payload = { hasNextPage: null };
it(`dispatches the ${types.SET_SELECTED_STAGE} and ${types.SET_PAGINATION} actions`, () => { it(`dispatches the ${types.SET_SELECTED_STAGE} and ${types.SET_PAGINATION} actions`, () => {
return testAction(actions.setSelectedStage, data, { ...state, selectedValueStream: {} }, [ return testAction(actions.setSelectedStage, data, { ...state, selectedValueStream: {} }, [
{ type: types.SET_SELECTED_STAGE, payload: data }, { type: types.SET_SELECTED_STAGE, payload: data },
{ type: types.SET_PAGINATION, payload },
]); ]);
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment