Commit cdd5e8a8 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'ss-simon/rm-data-from-mount' into 'master'

Remove unnecessary reactive properties in notes/mr_notes mount

See merge request gitlab-org/gitlab!31143
parents 09a50047 fb2b0960
...@@ -15,19 +15,6 @@ export default () => { ...@@ -15,19 +15,6 @@ export default () => {
notesApp, notesApp,
}, },
store, store,
data() {
const notesDataset = document.getElementById('js-vue-mr-discussions').dataset;
const noteableData = JSON.parse(notesDataset.noteableData);
noteableData.noteableType = notesDataset.noteableType;
noteableData.targetType = notesDataset.targetType;
return {
noteableData,
currentUserData: JSON.parse(notesDataset.currentUserData),
notesData: JSON.parse(notesDataset.notesData),
helpPagePath: notesDataset.helpPagePath,
};
},
computed: { computed: {
...mapGetters(['discussionTabCounter']), ...mapGetters(['discussionTabCounter']),
...mapState({ ...mapState({
...@@ -67,6 +54,19 @@ export default () => { ...@@ -67,6 +54,19 @@ export default () => {
updateDiscussionTabCounter() { updateDiscussionTabCounter() {
this.notesCountBadge.text(this.discussionTabCounter); this.notesCountBadge.text(this.discussionTabCounter);
}, },
dataset() {
const data = this.$el.dataset;
const noteableData = JSON.parse(data.noteableData);
noteableData.noteableType = data.noteableType;
noteableData.targetType = data.targetType;
return {
noteableData,
notesData: JSON.parse(data.notesData),
userData: JSON.parse(data.currentUserData),
helpPagePath: data.helpPagePath,
};
},
}, },
render(createElement) { render(createElement) {
// NOTE: Even though `discussionKeyboardNavigator` is added to the `notes-app`, // NOTE: Even though `discussionKeyboardNavigator` is added to the `notes-app`,
...@@ -76,11 +76,8 @@ export default () => { ...@@ -76,11 +76,8 @@ export default () => {
return createElement(discussionKeyboardNavigator, [ return createElement(discussionKeyboardNavigator, [
createElement('notes-app', { createElement('notes-app', {
props: { props: {
noteableData: this.noteableData, ...this.dataset(),
notesData: this.notesData,
userData: this.currentUserData,
shouldShow: this.isShowTabActive, shouldShow: this.isShowTabActive,
helpPagePath: this.helpPagePath,
}, },
}), }),
]); ]);
......
...@@ -14,38 +14,36 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -14,38 +14,36 @@ document.addEventListener('DOMContentLoaded', () => {
notesApp, notesApp,
}, },
store, store,
data() { methods: {
const notesDataset = document.getElementById('js-vue-notes').dataset; setData() {
const parsedUserData = JSON.parse(notesDataset.currentUserData); const notesDataset = this.$el.dataset;
const noteableData = JSON.parse(notesDataset.noteableData); const parsedUserData = JSON.parse(notesDataset.currentUserData);
let currentUserData = {}; const noteableData = JSON.parse(notesDataset.noteableData);
let currentUserData = {};
noteableData.noteableType = notesDataset.noteableType; noteableData.noteableType = notesDataset.noteableType;
noteableData.targetType = notesDataset.targetType; noteableData.targetType = notesDataset.targetType;
if (parsedUserData) { if (parsedUserData) {
currentUserData = { currentUserData = {
id: parsedUserData.id, id: parsedUserData.id,
name: parsedUserData.name, name: parsedUserData.name,
username: parsedUserData.username, username: parsedUserData.username,
avatar_url: parsedUserData.avatar_path || parsedUserData.avatar_url, avatar_url: parsedUserData.avatar_path || parsedUserData.avatar_url,
path: parsedUserData.path, path: parsedUserData.path,
}; };
} }
return { return {
noteableData, noteableData,
currentUserData, userData: currentUserData,
notesData: JSON.parse(notesDataset.notesData), notesData: JSON.parse(notesDataset.notesData),
}; };
},
}, },
render(createElement) { render(createElement) {
return createElement('notes-app', { return createElement('notes-app', {
props: { props: { ...this.setData() },
noteableData: this.noteableData,
notesData: this.notesData,
userData: this.currentUserData,
},
}); });
}, },
}); });
......
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