core: move plugin intialisation to config layer override#22620
Merged
Brendonovich merged 4 commits intodevfrom Apr 15, 2026
Merged
core: move plugin intialisation to config layer override#22620Brendonovich merged 4 commits intodevfrom
Brendonovich merged 4 commits intodevfrom
Conversation
Contributor
|
G'day legends, Had a squiz at this PR and reckon the approach is spot on — getting plugin init out of the hot path is a ripper idea for startup perf. No dramas there. Just wanted to chuck in a suggestion: you could use const ConfigWithPluginPriority = Layer.effect(
Config.Service,
Effect.gen(function* () {
const config = yield* Config.Service
const plugin = yield* Plugin.Service
return {
...config,
get: () => Effect.andThen(plugin.init(), config.get),
getGlobal: () => Effect.andThen(plugin.init(), config.getGlobal),
getConsoleState: () => Effect.andThen(plugin.init(), config.getConsoleState),
}
}),
).pipe(Layer.provide(Layer.merge(Plugin.defaultLayer, Config.defaultLayer)))The gist of it:
She'll be right either way — functionally it's the same — but Cheers, |
kitlangton
added a commit
that referenced
this pull request
Apr 16, 2026
)" This reverts commit 916131b.
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.
As noted in #22547 we need to initialise the Plugin service before any others as they are able to modify the config. This PR removes the plugin initialisation from the bootstrap flow's hot path and into the Config service methods themselves by overriding the Config layer implementation to ensure the Plugin service is always inited first.
All of this is in order to get the Config init out of the hot path as it can take a while, especially for OC Console users because of the network requests involved. This lets us tune the hell out of Desktop startup performance as a bunch of important data (session list, message parts) don't require loading the config.