fix(plugin): remember last unpacked plugin directory#12697
Open
VictorVow wants to merge 1 commit into
Open
Conversation
The "Load unpacked plugin" dialog previously opened with no defaultPath, so the OS picker fell back to whatever location it remembered for that dialog purpose — often unrelated to the user's plugin folder. Persist the last picked path in local storage and pass its parent as defaultPath on subsequent opens, so the picker lands next to sibling plugin folders.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the UX of “Load unpacked plugin” on Electron by remembering the last selected unpacked plugin directory and using it to seed the next native directory picker location.
Changes:
- Persist the last selected unpacked plugin path in frontend local storage (
:lsp-last-unpacked-plugin-path) and reuse it on subsequent dialog opens. - Extend the Electron main-process
open-dir-dialoghelper to accept an optionaldefault-pathand setshowOpenDialog’sdefaultPathto the parent directory viapath.dirname. - Update the
:openDialogIPC handler to forward the optionaldefault-pathargument.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/main/frontend/handler/plugin.cljs | Reads/writes the last unpacked plugin path in local storage and passes it into the openDialog IPC call. |
| src/electron/electron/handler.cljs | Adds optional default-path support to open-dir-dialog and forwards it from the :openDialog IPC handler to Electron’s showOpenDialog. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The "Load unpacked plugin" dialog previously called
showOpenDialogwith nodefaultPath, so the OS native picker (xdg-desktop-portal / GTK on Linux, equivalents on macOS/Windows) fell back to whatever location it had cached for the "open directory" purpose — often unrelated to the user's plugin folder and never updated by Logseq itself.This change persists the last picked path in local storage as
:lsp-last-unpacked-plugin-path, and passes its parent directory asdefaultPathon subsequent opens, so the picker lands right next to the previously loaded plugin's sibling folders.src/electron/electron/handler.cljs—open-dir-dialognow takes an optionaldefault-path; usespath.dirnameso the picker opens at the parent of the last selection.:openDialogIPC handler forwards the optional argument.src/main/frontend/handler/plugin.cljs—load-unpacked-pluginreads the persisted path, passes it to the IPC, and stores the new pick.Test plan