2020-03-13 15:44:24 +05:30
|
|
|
import Vue from 'vue';
|
2021-09-04 01:27:46 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
2020-11-24 15:15:51 +05:30
|
|
|
import Vuex from 'vuex';
|
2021-09-04 01:27:46 +05:30
|
|
|
import createDefaultClient from '~/lib/graphql';
|
2021-04-29 21:17:54 +05:30
|
|
|
import ReleaseIndexApp from './components/app_index.vue';
|
2021-09-04 01:27:46 +05:30
|
|
|
import ReleaseIndexApollopClientApp from './components/app_index_apollo_client.vue';
|
2020-03-13 15:44:24 +05:30
|
|
|
import createStore from './stores';
|
2021-04-29 21:17:54 +05:30
|
|
|
import createIndexModule from './stores/modules/index';
|
2020-11-24 15:15:51 +05:30
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
export default () => {
|
|
|
|
const el = document.getElementById('js-releases-page');
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
if (window.gon?.features?.releasesIndexApolloClient) {
|
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
|
|
|
const apolloProvider = new VueApollo({
|
|
|
|
defaultClient: createDefaultClient(
|
|
|
|
{},
|
|
|
|
{
|
|
|
|
// This page attempts to decrease the perceived loading time
|
|
|
|
// by sending two requests: one request for the first item only (which
|
|
|
|
// completes relatively quickly), and one for all the items (which is slower).
|
|
|
|
// By default, Apollo Client batches these requests together, which defeats
|
|
|
|
// the purpose of making separate requests. So we explicitly
|
|
|
|
// disable batching on this page.
|
|
|
|
batchMax: 1,
|
|
|
|
assumeImmutableResults: true,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
});
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
apolloProvider,
|
|
|
|
provide: { ...el.dataset },
|
|
|
|
render: (h) => h(ReleaseIndexApollopClientApp),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Vue.use(Vuex);
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
return new Vue({
|
|
|
|
el,
|
2020-04-08 14:13:33 +05:30
|
|
|
store: createStore({
|
|
|
|
modules: {
|
2021-04-29 21:17:54 +05:30
|
|
|
index: createIndexModule(el.dataset),
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
2020-04-08 14:13:33 +05:30
|
|
|
}),
|
2021-04-29 21:17:54 +05:30
|
|
|
render: (h) => h(ReleaseIndexApp),
|
2020-03-13 15:44:24 +05:30
|
|
|
});
|
|
|
|
};
|