Skip to content

Commit 2353b4a

Browse files
Chau TranChau Tran
Chau Tran
authored and
Chau Tran
committed
fix(soba): use Object.is for ground texture equal fn
1 parent cbd0057 commit 2353b4a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

libs/soba/staging/src/environment/environment-ground.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ export class NgtsEnvironmentGround {
2121
protected readonly environmentInput = inject(NgtsEnvironmentInput);
2222
readonly #defaultTexture = injectNgtsEnvironment(this.environmentInput.environmentParams);
2323

24-
readonly texture = computed(() => {
25-
const defaultTexture = this.#defaultTexture.nativeElement;
26-
return this.environmentInput.environmentMap() || defaultTexture;
27-
});
24+
readonly texture = computed(
25+
() => {
26+
const defaultTexture = this.#defaultTexture.nativeElement;
27+
return this.environmentInput.environmentMap() || defaultTexture;
28+
},
29+
{ equal: Object.is }
30+
);
2831

2932
readonly groundArgs = computed(() => (this.texture() ? [this.texture()] : []));
3033
readonly height = computed(() => (this.environmentInput.environmentGround() as any)?.height);

libs/soba/staging/src/environment/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ type NgtsInjectEnvironmentParams = Partial<
5555
const CUBEMAP_ROOT = 'https://market-assets.fra1.cdn.digitaloceanspaces.com/market-assets/hdris/';
5656
export function injectNgtsEnvironment(paramsFactory: () => Partial<NgtsInjectEnvironmentParams>, injector?: Injector) {
5757
injector = assertInjectionContext(injectNgtsEnvironment, injector);
58+
const textureRef = injectNgtRef<THREE.Texture | CubeTexture>();
5859
return runInInjectionContext(injector, () => {
5960
const cdr = inject(ChangeDetectorRef);
60-
const textureRef = injectNgtRef<THREE.Texture | CubeTexture>();
6161

6262
inject(DestroyRef).onDestroy(() => {
6363
textureRef.untracked.dispose();

0 commit comments

Comments
 (0)