Commit 2939b8b8 authored by Tim Zallmann's avatar Tim Zallmann

Show DD contents with v-if, cache labels locally

parent 4f8fb373
...@@ -315,7 +315,7 @@ export default { ...@@ -315,7 +315,7 @@ export default {
</dropdown-value> </dropdown-value>
<dropdown-button v-show="dropdownButtonVisible" class="gl-mt-2" /> <dropdown-button v-show="dropdownButtonVisible" class="gl-mt-2" />
<dropdown-contents <dropdown-contents
v-show="dropdownButtonVisible && showDropdownContents" v-if="dropdownButtonVisible && showDropdownContents"
ref="dropdownContents" ref="dropdownContents"
:render-on-top="!contentIsOnViewport" :render-on-top="!contentIsOnViewport"
/> />
......
...@@ -21,13 +21,15 @@ export const receiveLabelsFailure = ({ commit }) => { ...@@ -21,13 +21,15 @@ export const receiveLabelsFailure = ({ commit }) => {
}); });
}; };
export const fetchLabels = ({ state, dispatch }) => { export const fetchLabels = ({ state, dispatch }) => {
dispatch('requestLabels'); if (!state.labelsFetched) {
return axios dispatch('requestLabels');
.get(state.labelsFetchPath) return axios
.then(({ data }) => { .get(state.labelsFetchPath)
dispatch('receiveLabelsSuccess', data); .then(({ data }) => {
}) dispatch('receiveLabelsSuccess', data);
.catch(() => dispatch('receiveLabelsFailure')); })
.catch(() => dispatch('receiveLabelsFailure'));
}
}; };
export const requestCreateLabel = ({ commit }) => commit(types.REQUEST_CREATE_LABEL); export const requestCreateLabel = ({ commit }) => commit(types.REQUEST_CREATE_LABEL);
......
...@@ -36,6 +36,7 @@ export default { ...@@ -36,6 +36,7 @@ export default {
// selectedLabels array. // selectedLabels array.
const selectedLabelIds = state.selectedLabels.map((label) => label.id); const selectedLabelIds = state.selectedLabels.map((label) => label.id);
state.labelsFetchInProgress = false; state.labelsFetchInProgress = false;
state.labelsFetched = true;
state.labels = labels.reduce((allLabels, label) => { state.labels = labels.reduce((allLabels, label) => {
allLabels.push({ allLabels.push({
...label, ...label,
......
export default () => ({ export default () => ({
// Initial Data // Initial Data
labels: [], labels: [],
labelsFetched: false,
selectedLabels: [], selectedLabels: [],
labelsListTitle: '', labelsListTitle: '',
labelsCreateTitle: '', labelsCreateTitle: '',
......
...@@ -330,7 +330,7 @@ export default { ...@@ -330,7 +330,7 @@ export default {
</dropdown-value> </dropdown-value>
<dropdown-button v-show="dropdownButtonVisible" class="gl-mt-2" /> <dropdown-button v-show="dropdownButtonVisible" class="gl-mt-2" />
<dropdown-contents <dropdown-contents
v-show="dropdownButtonVisible && showDropdownContents" v-if="dropdownButtonVisible && showDropdownContents"
ref="dropdownContents" ref="dropdownContents"
:render-on-top="!contentIsOnViewport" :render-on-top="!contentIsOnViewport"
:labels-create-title="labelsCreateTitle" :labels-create-title="labelsCreateTitle"
......
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