save callback on this, and await folder functions #242
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This chang fixes an issue that is occurring for me in the beta version of the editor. Both the deployed beta page, and the beta branch when running locally behave the same for me and they're currently having this Javascript error when I click the 'Select Host Folder' or 'Use Host Folder' buttons
I added some additional console logging and found that
this.fileHelper
was indeed undefined when it tried to be accessed by this callback.I looked into the changes from main to beta and saw that these callbacks used to be wrapped in the anonymous async functions and awaited so I tried putting that back and it seems to resolve the issue.
I also store the callback so that it can later be passed to
removeEventListener()
This is very similar to what ended up being a fix for the duplicated serial output, I'll submit a separate PR for that fix though as its unrelated to this JS error I believe.I tested this version locally and found that with it I am now able to select the host folder successfully and carry on using the editor.