Commit 1ead1684 authored by Phil Hughes's avatar Phil Hughes

Fixed failing Jest specs

This was caused by a Vuex store getting setup when it didn't
need to be setup.
parent 46c67eb7
import Vue from 'vue';
import Vuex from 'vuex';
import store from './store';
import createStore from './store';
import App from './components/app.vue';
Vue.use(Vuex);
export default initialData => {
const el = document.getElementById('js-code-navigation');
if (!el) return null;
Vue.use(Vuex);
const store = createStore();
store.dispatch('setInitialData', initialData);
return new Vue({
......
......@@ -3,8 +3,9 @@ import createState from './state';
import actions from './actions';
import mutations from './mutations';
export default new Vuex.Store({
actions,
mutations,
state: createState(),
});
export default () =>
new Vuex.Store({
actions,
mutations,
state: createState(),
});
......@@ -103,18 +103,20 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => {
commit(types.VIEW_DIFF_FILE, state.diffFiles[0].file_hash);
}
// eslint-disable-next-line promise/catch-or-return,promise/no-nesting
import('~/code_navigation').then(m =>
m.default({
blobs: state.diffFiles
.filter(f => f.code_navigation_path)
.map(f => ({
path: f.new_path,
codeNavigationPath: f.code_navigation_path,
})),
definitionPathPrefix: state.definitionPathPrefix,
}),
);
if (state.diffFiles?.length) {
// eslint-disable-next-line promise/catch-or-return,promise/no-nesting
import('~/code_navigation').then(m =>
m.default({
blobs: state.diffFiles
.filter(f => f.code_navigation_path)
.map(f => ({
path: f.new_path,
codeNavigationPath: f.code_navigation_path,
})),
definitionPathPrefix: state.definitionPathPrefix,
}),
);
}
}
return pagination.next_page;
......
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