Commit cd00bbae authored by Simon Knox's avatar Simon Knox Committed by Phil Hughes

Don't include mr_notes store on issue page

Async imports for both stores, so lint doesn't complain
about consistent return
parent 26dec3e5
...@@ -13,9 +13,9 @@ import sidebarSubscriptions from './components/subscriptions/sidebar_subscriptio ...@@ -13,9 +13,9 @@ import sidebarSubscriptions from './components/subscriptions/sidebar_subscriptio
import SidebarSeverity from './components/severity/sidebar_severity.vue'; import SidebarSeverity from './components/severity/sidebar_severity.vue';
import Translate from '../vue_shared/translate'; import Translate from '../vue_shared/translate';
import createDefaultClient from '~/lib/graphql'; import createDefaultClient from '~/lib/graphql';
import { store } from '~/notes/stores';
import { isInIssuePage, parseBoolean } from '~/lib/utils/common_utils'; import { isInIssuePage, parseBoolean } from '~/lib/utils/common_utils';
import mergeRequestStore from '~/mr_notes/stores'; import createFlash from '~/flash';
import { __ } from '~/locale';
import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vue/store'; import labelsSelectModule from '~/vue_shared/components/sidebar/labels_select_vue/store';
Vue.use(Translate); Vue.use(Translate);
...@@ -89,7 +89,9 @@ function mountConfidentialComponent(mediator) { ...@@ -89,7 +89,9 @@ function mountConfidentialComponent(mediator) {
const dataNode = document.getElementById('js-confidential-issue-data'); const dataNode = document.getElementById('js-confidential-issue-data');
const initialData = JSON.parse(dataNode.innerHTML); const initialData = JSON.parse(dataNode.innerHTML);
// eslint-disable-next-line no-new import(/* webpackChunkName: 'notesStore' */ '~/notes/stores')
.then(
({ store }) =>
new Vue({ new Vue({
el, el,
store, store,
...@@ -105,20 +107,40 @@ function mountConfidentialComponent(mediator) { ...@@ -105,20 +107,40 @@ function mountConfidentialComponent(mediator) {
service: mediator.service, service: mediator.service,
}, },
}), }),
}),
)
.catch(() => {
createFlash({ message: __('Failed to load sidebar confidential toggle') });
}); });
} }
function mountLockComponent() { function mountLockComponent() {
const el = document.getElementById('js-lock-entry-point'); const el = document.getElementById('js-lock-entry-point');
if (!el) {
return;
}
const { fullPath } = getSidebarOptions(); const { fullPath } = getSidebarOptions();
const dataNode = document.getElementById('js-lock-issue-data'); const dataNode = document.getElementById('js-lock-issue-data');
const initialData = JSON.parse(dataNode.innerHTML); const initialData = JSON.parse(dataNode.innerHTML);
return el let importStore;
? new Vue({ if (isInIssuePage()) {
importStore = import(/* webpackChunkName: 'notesStore' */ '~/notes/stores').then(
({ store }) => store,
);
} else {
importStore = import(/* webpackChunkName: 'mrNotesStore' */ '~/mr_notes/stores');
}
importStore
.then(
store =>
new Vue({
el, el,
store: isInIssuePage() ? store : mergeRequestStore, store,
provide: { provide: {
fullPath, fullPath,
}, },
...@@ -128,8 +150,11 @@ function mountLockComponent() { ...@@ -128,8 +150,11 @@ function mountLockComponent() {
isEditable: initialData.is_editable, isEditable: initialData.is_editable,
}, },
}), }),
}) }),
: undefined; )
.catch(() => {
createFlash({ message: __('Failed to load sidebar lock status') });
});
} }
function mountParticipantsComponent(mediator) { function mountParticipantsComponent(mediator) {
...@@ -219,7 +244,7 @@ function mountSeverityComponent() { ...@@ -219,7 +244,7 @@ function mountSeverityComponent() {
export function mountSidebar(mediator) { export function mountSidebar(mediator) {
mountAssigneesComponent(mediator); mountAssigneesComponent(mediator);
mountConfidentialComponent(mediator); mountConfidentialComponent(mediator);
mountLockComponent(mediator); mountLockComponent();
mountParticipantsComponent(mediator); mountParticipantsComponent(mediator);
mountSubscriptionsComponent(mediator); mountSubscriptionsComponent(mediator);
......
...@@ -10623,6 +10623,12 @@ msgstr "" ...@@ -10623,6 +10623,12 @@ msgstr ""
msgid "Failed to load related branches" msgid "Failed to load related branches"
msgstr "" msgstr ""
msgid "Failed to load sidebar confidential toggle"
msgstr ""
msgid "Failed to load sidebar lock status"
msgstr ""
msgid "Failed to load stacktrace." msgid "Failed to load stacktrace."
msgstr "" msgstr ""
......
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