seiyable / vue-simple-svg

A simple Vue.js plugin that allows you to load a SVG image as an inline SVG with an access to change its fill colors
MIT License
80 stars 23 forks source link

Ending up with multiple icons when filepath changes fast #13

Open dietergeerts opened 5 years ago

dietergeerts commented 5 years ago

We use the simple svg to show the status of a document generation and finally the download icon for it. Because this changes fast, this component doesn't remove the first icon, as while setting the second, it was not yet loaded. This is what I can see while debugging:

Because the previous icon is removed when the method is entered, if it was there, it's not in this case, as it wasn't added yet.

I know we can use the ready event, but that's just a workaround. This should be fixed, and probably improved by canceling the request when a new one is needed to be done.

dietergeerts commented 5 years ago

Trying for the workaround with the ready event, I see now that it's impossible. When it goes wrong, we don't get notified of an error either... I don't know the good way of doing this, but it has to be changed so we are notified of being done, even if it was an error, and possibly a way to throw the error up, or hook it up to custom error handling, messaging to the user with i18n.