Commit 6895b6c4 authored by lauraMon's avatar lauraMon

Fixes mutations with cursor

parent 4d7c2987
......@@ -76,14 +76,15 @@ export function clearRecentSearches({ commit }) {
export const searchByQuery = ({ commit, dispatch }, query) => {
const searchQuery = query.trim();
commit(types.SET_CURSOR, null);
commit(types.SET_SEARCH_QUERY, searchQuery);
commit(types.ADD_RECENT_SEARCH, searchQuery);
dispatch('stopPolling');
dispatch('startPolling');
};
export const sortByField = ({ commit, dispatch }, field, cursor) => {
commit(types.SET_CURSOR, cursor);
export const sortByField = ({ commit, dispatch }, field) => {
commit(types.SET_CURSOR, null);
commit(types.SET_SORT_FIELD, field);
dispatch('stopPolling');
dispatch('startPolling');
......
......@@ -79,6 +79,7 @@ describe('error tracking actions', () => {
query,
{},
[
{ type: types.SET_CURSOR, payload: null },
{ type: types.SET_SEARCH_QUERY, payload: query },
{ type: types.ADD_RECENT_SEARCH, payload: query },
],
......@@ -95,10 +96,7 @@ describe('error tracking actions', () => {
actions.sortByField,
field,
{},
[
{ type: types.SET_CURSOR, payload: undefined },
{ type: types.SET_SORT_FIELD, payload: field },
],
[{ type: types.SET_CURSOR, payload: null }, { type: types.SET_SORT_FIELD, payload: field }],
[{ type: 'stopPolling' }, { type: 'startPolling' }],
);
});
......
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