@@ -24,7 +24,7 @@ import {
2424import { injectNgtDestroy , injectNgtRef , NgtInjectedRef , tapEffect } from 'angular-three' ;
2525import { NgtcStore , NgtcUtils } from 'angular-three-cannon' ;
2626import { NGTC_DEBUG_API } from 'angular-three-cannon/debug' ;
27- import { combineLatest , Observable , ReplaySubject , Subscription } from 'rxjs' ;
27+ import { combineLatest , Observable , Subscription } from 'rxjs' ;
2828import * as THREE from 'three' ;
2929
3030export type NgtcAtomicApi < K extends AtomicName > = {
@@ -167,16 +167,11 @@ function injectBody<TBodyProps extends BodyProps, TObject extends THREE.Object3D
167167) : NgtcBodyReturn < TObject > {
168168 let subscription : Subscription | undefined = undefined ;
169169
170- // a ReplaySubject that would emit whenever our props emits. This is done so that the consumers can pass in
171- // Observable to injectBody if they have reactive props (eg: Input)
172- const propsSubjectList = [ ] as ReplaySubject < TBodyProps > [ ] ;
173-
174170 const debugApi = inject ( NGTC_DEBUG_API , { skipSelf : true , optional : true } ) ;
175171 const physicsStore = inject ( NgtcStore , { skipSelf : true } ) ;
176172
177173 // clean up our streams on destroy
178174 injectNgtDestroy ( ( ) => {
179- propsSubjectList . forEach ( ( sub ) => sub . complete ( ) ) ;
180175 subscription ?. unsubscribe ( ) ;
181176 } ) ;
182177
@@ -190,7 +185,9 @@ function injectBody<TBodyProps extends BodyProps, TObject extends THREE.Object3D
190185 queueMicrotask ( ( ) => {
191186 // waitFor assumes the consumer will be using the bodyRef on the template
192187 // with the model (waitFor) as a THREE instance
193- if ( ! waitFor ) bodyRef . nativeElement ||= new THREE . Object3D ( ) as TObject ;
188+ if ( ! waitFor && ! bodyRef . nativeElement ) {
189+ bodyRef . nativeElement = new THREE . Object3D ( ) as TObject ;
190+ }
194191 } ) ;
195192
196193 // start the pipeline as soon as bodyRef has a truthy value
0 commit comments