-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add defaultPath
option to set the default directory for file dialog
#15282
Conversation
Thanks for making a pull request to jupyterlab! |
There was a floating promise in createFilteredFileBrowser as a result of calling model.cd(). To fix the floating promise, createdFilteredFileBrowser is async and respective changes propagated to places it was used.
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.
Thanks @mmichilot
CI failures are not related |
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.
Thank you @mmichilot
defaultPath
option to set the default directory for file dialog
Apologies for the duplicate pull request, decided to move changes into a separate branch
References
Adds the defaultPath option referenced in #12929
Code changes
Adds a new optional
defaultPath
option toIDirectoryOptions
. This option is then passed tocreateFilteredFileBrowser
where it usesdefaultPath
to change the directory of the model. The resulting file dialog opens to the given path instead of root.Also added two new tests to verify
defaultPath
functionality.Within a folder in root, a new file and folder are added as shown:
The tests check that the parent directory of the selected file/folder matches the given
defaultPath
.User-facing changes
None
Backwards-incompatible changes
None
Additional Question(s)
There is a lint error regarding floating promises. Since
model.cd()
returnsPromise<void>
and doesn't throw an error, would it be safe to mark the call as intentionally not awaited using the void operator?