-
-
Notifications
You must be signed in to change notification settings - Fork 446
Fix bookmark plugin file monitoring issue #2152
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
Fix bookmark plugin file monitoring issue #2152
Conversation
* Remove LastAccessed filter to avoid unwanted recursive RegisterBookmarkFile() calls * Check if watcher exists
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
// Don't load or monitor files if disabled | ||
// Note: It doesn't start loading or monitoring if enabled later, you need to manually reload data | ||
return; | ||
} |
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.
We shouldn't call init() when plugin is disabled.
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.
true, let's add a flag to indicate whether a plugin is initialized
The issue for now is that if user re-enable the plugin, it won't be initialized
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.
Yeah but it's not the point of this PR.
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.
should we call init every time plugin is reenabled?
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.
should we call init every time plugin is reenabled?
Technically we should but some plugins may need to update. like if we don't dispose file watchers when disabling plugins, creating new ones after re enabling may lead to some issues.
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 agree with @taooceros that the plugin manager should keep track of what plugins have been initialized or not (with a flag). This allows us to skip initializing disabled plugins on start-up. When a plugin is enabled, we can check the flag to determine if its Init
method should be called or not.
This check does not belong in the Init
of individual plugins...
Then we need to change all plugins. init method passes context object to plugin, which is necessary for localized plugin names and descriptions in settings window. |
Why do we? |
i18n plugins uses plugincontext.API to retrieve localized plugin names. if we simply stop invoking init method of disabled plugins the plugin context is null and raises errors. |
What I said was that we should invoke their |
Yeah. Anyway should I remove the check in this PR? It's going off-topic and checking it in |
This isn't off-topic, you have made a change that introduces a different issue (when the plugin is enabled later, as you noted) 😉 Anyway, I'm okay with keeping this as a temporary solution, but let's add a quick flag inside the bookmarks plugin that tracks if bookmarks have been loaded or not. At the top of |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@VictoriousRaptor let's remove that delay and get the branch up-to-date with dev |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Let's get another pair of eyes on this before merging
Co-authored-by: Jeremy Wu <[email protected]>
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view or the 📜action log for details. Unrecognized words (1)Firefox To accept ✔️ these unrecognized words as correct and remove the previously acknowledged and now absent words, run the following commands... in a clone of the [email protected]:VictoriousRaptor/Flow.Launcher.git repository curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/main/apply.pl' |
perl - 'https://github.com/Flow-Launcher/Flow.Launcher/actions/runs/5407282387/attempts/1' If the flagged items are 🤯 false positivesIf items relate to a ...
|
Fixes #2120 and maybe fixes #2138.
Changes
LastAccessed
filter to avoid unwantedRegisterBookmarkFile()
callsTests
LastAccessed
filter of the file watcher, an attempt to load bookmarks invokes a second call to load.