Ensure notification service is available when sending a notification #720
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 is a bit of a weird patch for a fundamental order-of-execution issue.
The bundler (esbuild) can sometimes place the
notifdService
instantiation bellow the code callingNotify
, which would causes thenotify-send
execution to fail. To avoid this, we can make it seem likenotifdService
is being used insideNotify
, so that it is always placed above the usage of the function, ensuring that we always have a notification daemon runningThis issue has become apparent to me as I have upgraded Hyprpanel, as sometimes the
"swww is a missing dependency"
notification would sometimes show up on startup and sometimes not (it would depend on where the bundler would place the piece of code).Additionally, this will allow #684 to send notifications when creating the configuration, for the same reason as listed above.
If anybody knows a better way to indicate to the bundler to always place
src/lib/constants/services.ts
at the top of the bundle, then that would be a way better fix, but I have been unable to find a way to do it