williamcruzme / vue-gates

🔒 A Vue.js & Nuxt.js plugin that allows you to use roles and permissions in your components or DOM elements, also compatible as middleware and methods.
https://williamcruzme.github.io/vue-gates/
MIT License
264 stars 31 forks source link

Changing Permissions removes Parent and Children from DOM in wrong order (using bootstrap) #49

Open christianhpoe opened 2 years ago

christianhpoe commented 2 years ago

When changing the permissions in a running application (e.g. by calling a backend for updated permission) and updating them through setPermissions, many components rendering child components get removed from outward to inward. This leads to an error, where children try to remove themselve from a non existing parent. This happens with multiple bootstrap components. Attached you can find the errors and a code example.

Errors image image

Code image

Temporary Fix: You can fix this by using a v-show instead of the provided v-permission, which does not remove the element from the DOM but just hides it. As this can come with unwanted security implications its not an ideal fix. image

Do you have any suggestion, how to fix this?

m7salam commented 2 years ago

same happened with me as well , hopefully the maintainer can find a solution for this