@3dsource/angular-unreal-module 0.0.143-dev.8 → 0.0.143

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7191,20 +7191,21 @@ class UnrealSceneComponent {
7191
7191
  this.unrealConfig = inject(UNREAL_CONFIG);
7192
7192
  this.autoHighResolution = false;
7193
7193
  this.destroyRef.onDestroy(() => {
7194
- // Resource release MUST be synchronous and must NOT depend on the
7195
- // route-scoped UnrealEffects. provideUnreal() is registered per 3D route,
7196
- // so on navigation the route's environment injector (and its
7197
- // UnrealEffects) can be torn down before the
7198
- // `destroyUnrealScene → destroyRemoteConnections` effect chain — which
7199
- // closes the PeerConnection/WebSocket — gets a chance to run, leaking the
7200
- // stream session. The engine services are providedIn:'root' singletons,
7201
- // so we close them directly here. close()/closePC() are idempotent, so
7202
- // the effect chain re-running them (when it does run) is a harmless no-op.
7203
- this.webRtcPlayerService.closePC();
7194
+ // Mirror of the `destroyRemoteConnections$` effect's teardown tap, run
7195
+ // directly here as a safeguard. provideUnrealModule (effects) is
7196
+ // registered per 3D route, so on navigation the route's environment
7197
+ // injector — and its UnrealEffects — may be torn down before the
7198
+ // `destroyUnrealScene → destroyRemoteConnections` effect chain closes the
7199
+ // WebSocket/PeerConnection, which would leak the stream session. The
7200
+ // engine services are providedIn:'root' singletons, so we close them
7201
+ // directly. Keep the SAME calls, args and order as the effect's tap
7202
+ // (close → closePC); both are idempotent, so whichever runs second is a
7203
+ // harmless no-op.
7204
7204
  this.signallingService.close({
7205
7205
  code: WSCloseCode_FORCE_CIRRUS_CLOSE,
7206
7206
  reason: DisconnectReason.Destroy,
7207
7207
  });
7208
+ this.webRtcPlayerService.closePC();
7208
7209
  // State cleanup is reducer-driven, not effect-driven: the
7209
7210
  // `destroyUnrealScene` reducer resets the whole UnrealState to
7210
7211
  // initialState (cirrusConnected/viewportReady/… → false). Reducers run in