refactor(server): remove module forwardRefs left by the settings split#2958
Merged
Conversation
#2955 split the SettingsService god-object and made SettingsModule a @global provider of SettingsDataService, but left the module-level forwardRef wiring in place. With the settings cycles gone, those forwardRefs are now removable. - Drop the vestigial `forwardRef(() => SettingsModule)` import from the Plex, TMDB, TVDB, Jellyfin and Emby modules: each only reads settings via the @global SettingsDataService, so it needs no import at all. - Convert SettingsModule's nine `forwardRef(() => XApiModule)` imports to plain imports now that no API module imports SettingsModule back. - Break the last MediaServerFactory <-> MediaServerSwitchService cycle (the pair #2955 called irreducible) by extracting the in-progress flag into a zero- dependency MediaServerSwitchState holder: the factory reads it, the switch service writes it, neither depends on the other. This removes the final two constructor forwardRefs and their two @swc/jest type-only aliases. - Move the data-only testSetup() onto SettingsDataService (kept as a delegating wrapper on SettingsOperationsService) so MediaServerSetupGuard reads it from the @global service, letting MediaServerModule drop its SettingsModule import. forwardRef constructor injections and type-only aliases both drop to 0. The only remaining forwardRefs are the genuine, pre-existing CollectionsModule <-> RulesModule domain cycle, untouched here. No behaviour change.
Contributor
|
🎉 This PR is included in version 3.12.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Follow-up to #2955. That PR split the
SettingsServicegod-object and madeSettingsModulea@Globalprovider ofSettingsDataService, but left the module-levelforwardRefwiring (and the one constructor cycle it called irreducible) in place. With the settings cycles gone, those workarounds are now removable.What this does
@GlobalSettingsDataService, so theirforwardRef(() => SettingsModule)import is dropped entirely.forwardRef(() => XApiModule)imports become plain imports, now that no API module importsSettingsModuleback.MediaServerFactory ↔ MediaServerSwitchServiceis broken by extracting the in-progress flag into a zero-dependencyMediaServerSwitchStateholder: the factory reads it, the switch service writes it, neither depends on the other.testSetup()moves ontoSettingsDataService(kept as a delegating wrapper onSettingsOperationsService), soMediaServerSetupGuardreads it from the@Globalservice andMediaServerModuledrops itsSettingsModuleimport.Result
forwardRefimportsforwardRefconstructor injections@swc/jesttype-only aliasesThe only remaining
forwardRefs are the genuine, pre-existingCollectionsModule ↔ RulesModuledomain cycle (RulesServiceinjectsCollectionsService;CollectionsControllerreads the rule executor's processing state), untouched here and a clean candidate for the same flag-extraction pattern in a follow-up.Behaviour
Unchanged. The switch/conflict semantics, the public
testSetupAPI, and the media-server setup guard all behave as before — only their wiring moved.Validation
build (tsc) ✓ · 75 suites / 1336 tests ✓ · lint ✓ · prettier ✓ · full Nest DI context boots with the rewired providers (no circular dependency) ✓.