Closed MintyTrebor closed 1 year ago
I am surprised it works, because the callback inside Vue.nextTick is called when the DOM has been updated and you don't await the promise returned by it - see https://v2.vuejs.org/v2/api/#Vue-nextTick
I suppose something like
await Vue.nextTick(() => {});
in registerCategory would be safer.
You can do
await Vue.nextTick()
instead since the callback is optional and the promise is resolved after the DOM update.
I may have some more changes to make to this file so feel free to decline : I am trying to get the router to allow me to have multiple menu items going to the same component with different props, and the some of the router properties I may need are not defined in the MenuItem interface - so I may end up sending through another pull request.
closing - further updates needed
If a plugin attempts to register a new menu category using 'registerCategory', and then immediately attempts to register routes for child components of the new menu category, the menu does not update on screen. By adding a nextTick=>return to the 'registerCategory' function, it ensures the DOM/Component is updated before the child components are added, and the menu is updated on screen as expected.