New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable export button in UI while exporting #179
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for dsi-logo-maker ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the idea, and the events approach is interesting to me. Some other features could be approached from this point.
Tho, I think it's not working, specifically the try to catch the startDownload moment. I ran it locally with a fresh new project, I export once and the button then remains disabled.
The approach here tries subscribing on the lastRun object, which already ran the engine, and therefore the download part.
I feel like there's space here then to re-factor how the mechanic object run cycle behaves. Cause right now, it's the UI, saying to the iframe to run the engine, it's the engine who creates the mechanic object instance with all the values and other things, it validates things but also goes ahead and runs the DF. Then after that it returns to the UI the result of the run. I think there's space to reconsider how that life-cycle works, maybe the mechanic instance is begun in the UI with the information it has at the moment, there's time to subscribe to events before actually running the DF, and then telling the iframe to run. Also with the events idea, I feel like there's room to also map out the lifecycle as an internal state based lifecycle, which the UI responds to based on subscriptions.
Tho this might be a bit much before the 2.0.0 update. So maybe let's reconsider if any other "simpler" options come to mind.
off(event, listener) { | ||
let idx; | ||
|
||
if (typeof this.events[event] === "object") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (typeof this.events[event] === "object") { | |
if (Array.isArray(this.events[event])) { |
I'm under the impression that this is more accurate to what we want to do here.
emit(event, ...args) { | ||
let i, listeners, length; | ||
|
||
if (typeof this.events[event] === "object") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (typeof this.events[event] === "object") { | |
if (Array.isArray(this.events[event])) { |
Same here
A tiny quality of life change to the UI.
Export
andGenerate
buttons are disabled while an export is running to more clearly communicate to the user that something is happening