where to put Vue side effects
Sometimes we need to do window stuff, or update some non-vue element that (probably) exists in the DOM. Not ideal, but it is what it is. Deciding a preferred place to put the bad code makes it easier to add, and easier to clean up later.
Ideas:
- Put side effects in actions, mock them for tests
- Put in mutations. Kinda is a mutation, and DOM operations should be synchronous...
- Encapsulate in a component i.e. https://github.com/egoist/side-effect
Edited by 🤖 GitLab Bot 🤖