修复响应式查询缓存失效和测试隔离问题

This commit is contained in:
YHH
2025-10-14 11:48:04 +08:00
parent 360106fb92
commit 3b917a06af
10 changed files with 538 additions and 650 deletions

View File

@@ -547,7 +547,9 @@ export class Scene implements IScene {
constructor = systemTypeOrInstance;
if (this._services.isRegistered(constructor)) {
return this._services.resolve(constructor) as T;
const existingSystem = this._services.resolve(constructor) as T;
this.logger.debug(`System ${constructor.name} already registered, returning existing instance`);
return existingSystem;
}
if (isInjectable(constructor)) {
@@ -560,7 +562,17 @@ export class Scene implements IScene {
constructor = system.constructor;
if (this._services.isRegistered(constructor)) {
return system;
const existingSystem = this._services.resolve(constructor);
if (existingSystem === system) {
this.logger.debug(`System ${constructor.name} instance already registered, returning it`);
return system;
} else {
this.logger.warn(
`Attempting to register a different instance of ${constructor.name}, ` +
`but type is already registered. Returning existing instance.`
);
return existingSystem as T;
}
}
}
@@ -582,6 +594,8 @@ export class Scene implements IScene {
system.initialize();
this.logger.debug(`System ${constructor.name} registered and initialized`);
return system;
}