chandler icon indicating copy to clipboard operation
chandler copied to clipboard

The toaster component no longer works and needs to be replaced

Open djaiss opened this issue 2 years ago • 2 comments

We used to have a toaster that displayed success messages. It broke somehow and now it doesn't work anymore.

It's located in Toaster.vue.

There are two ways of calling it:

  • either by putting a message in the local storage, like localStorage.success = 'The contact has been edited'; and then it appears on next page load
  • or call the toaster directly with this.flash('The call reason type has been created', 'success');.

I have no idea why it doesn't work anymore. We either need to replace it, or make the current one work.

djaiss avatar Nov 01 '22 01:11 djaiss

Hey there, was poking around the codebase and I found the solution to this. It was somehow a dependecy mismatch. The <Toaster \> component uses mitt, and the methods.js mixin is using tiny-emitter. I can fix it depending on which do you want to keep as a dependency.

I could also add a unit test to catch something like this in the future, but that also would require adding jest to the project. Let me know how you'd want me to proceed and I can make a PR..

javier123454321 avatar Nov 17 '22 01:11 javier123454321

Thanks for your comment @javier123454321 I have no idea which one I want to keep as a dependency 😄

Both mitt and tiny-emitter were added because I saw a tutorial that shows a tutorial that probably indicated those two, but I don't really know this stuff so if you know better, please suggest something in the PR.

Also, it'd be great to add Jest, so if you are up for it, please go!

djaiss avatar Nov 18 '22 13:11 djaiss