diff options
author | Fatih Acet <acetfatih@gmail.com> | 2019-03-20 14:54:50 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2019-03-20 14:54:50 +0300 |
commit | 4ac994650e650ba2ed07a6c3fdc13a0e6008eed4 (patch) | |
tree | b5e4dd132a7812e460f754c593130812444d236b /app | |
parent | dfd097534b83272c9936be0bc222facd8e126559 (diff) | |
parent | c307bd473626250a5ac8caddce26c4c4b373b6c1 (diff) |
Merge branch '58883-fix-fetching-comments' into 'master'
Initialize discussionFilter after notesApp
Closes #58883
See merge request gitlab-org/gitlab-ce!26092
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/notes/components/discussion_filter.vue | 2 | ||||
-rw-r--r-- | app/assets/javascripts/notes/discussion_filters.js | 13 | ||||
-rw-r--r-- | app/assets/javascripts/notes/index.js | 7 |
3 files changed, 11 insertions, 11 deletions
diff --git a/app/assets/javascripts/notes/components/discussion_filter.vue b/app/assets/javascripts/notes/components/discussion_filter.vue index 31164f74201..47951591e82 100644 --- a/app/assets/javascripts/notes/components/discussion_filter.vue +++ b/app/assets/javascripts/notes/components/discussion_filter.vue @@ -22,7 +22,7 @@ export default { }, selectedValue: { type: Number, - default: null, + default: DISCUSSION_FILTERS_DEFAULT_VALUE, required: false, }, }, diff --git a/app/assets/javascripts/notes/discussion_filters.js b/app/assets/javascripts/notes/discussion_filters.js index 5c5f38a3fb0..cdf9a46c5aa 100644 --- a/app/assets/javascripts/notes/discussion_filters.js +++ b/app/assets/javascripts/notes/discussion_filters.js @@ -6,12 +6,16 @@ export default store => { if (discussionFilterEl) { const { defaultFilter, notesFilters } = discussionFilterEl.dataset; - const selectedValue = defaultFilter ? parseInt(defaultFilter, 10) : null; const filterValues = notesFilters ? JSON.parse(notesFilters) : {}; const filters = Object.keys(filterValues).map(entry => ({ title: entry, value: filterValues[entry], })); + const props = { filters }; + + if (defaultFilter) { + props.selectedValue = parseInt(defaultFilter, 10); + } return new Vue({ el: discussionFilterEl, @@ -21,12 +25,7 @@ export default store => { }, store, render(createElement) { - return createElement('discussion-filter', { - props: { - filters, - selectedValue, - }, - }); + return createElement('discussion-filter', { props }); }, }); } diff --git a/app/assets/javascripts/notes/index.js b/app/assets/javascripts/notes/index.js index 4883266dae5..30372103590 100644 --- a/app/assets/javascripts/notes/index.js +++ b/app/assets/javascripts/notes/index.js @@ -6,9 +6,8 @@ import createStore from './stores'; document.addEventListener('DOMContentLoaded', () => { const store = createStore(); - initDiscussionFilters(store); - - return new Vue({ + // eslint-disable-next-line no-new + new Vue({ el: '#js-vue-notes', components: { notesApp, @@ -49,4 +48,6 @@ document.addEventListener('DOMContentLoaded', () => { }); }, }); + + initDiscussionFilters(store); }); |