Commit d1e5923f authored by Mike Greiling's avatar Mike Greiling

Load dynamic chunk only when dropdown is open

parent 6a949cd4
...@@ -28,41 +28,40 @@ export default function initFrequentItemDropdowns() { ...@@ -28,41 +28,40 @@ export default function initFrequentItemDropdowns() {
return; return;
} }
$(navEl).on('shown.bs.dropdown', () => { $(navEl).on('shown.bs.dropdown', () =>
eventHub.$emit(`${namespace}-dropdownOpen`); import('./components/app.vue').then(({ default: FrequentItems }) => {
}); // eslint-disable-next-line no-new
new Vue({
el,
data() {
const { dataset } = this.$options.el;
const item = {
id: Number(dataset[`${key}Id`]),
name: dataset[`${key}Name`],
namespace: dataset[`${key}Namespace`],
webUrl: dataset[`${key}WebUrl`],
avatarUrl: dataset[`${key}AvatarUrl`] || null,
lastAccessedOn: Date.now(),
};
// eslint-disable-next-line no-new return {
new Vue({ currentUserName: dataset.userName,
el, currentItem: item,
components: { };
FrequentItems: () => import('./components/app.vue'), },
}, render(createElement) {
data() { return createElement(FrequentItems, {
const { dataset } = this.$options.el; props: {
const item = { namespace,
id: Number(dataset[`${key}Id`]), currentUserName: this.currentUserName,
name: dataset[`${key}Name`], currentItem: this.currentItem,
namespace: dataset[`${key}Namespace`], },
webUrl: dataset[`${key}WebUrl`], });
avatarUrl: dataset[`${key}AvatarUrl`] || null,
lastAccessedOn: Date.now(),
};
return {
currentUserName: dataset.userName,
currentItem: item,
};
},
render(createElement) {
return createElement('frequent-items', {
props: {
namespace,
currentUserName: this.currentUserName,
currentItem: this.currentItem,
}, },
}); });
},
}); eventHub.$emit(`${namespace}-dropdownOpen`);
}),
);
}); });
} }
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