Skip to content

Commit 2903bee

Browse files
committed
refactor(utils): remove deprecated function aliases
Remove getOrComputeCache and getOrCreateWithSideEffect aliases and update all references to use getOrCompute directly
1 parent 7261eea commit 2903bee

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

src/core/archetype.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getOrComputeCache } from "../utils/utils";
1+
import { getOrCompute } from "../utils/utils";
22
import {
33
buildCacheKey,
44
buildSingleComponent,
@@ -350,7 +350,7 @@ export class Archetype {
350350
componentTypes: T,
351351
): (any[] | EntityId<any>[] | undefined)[] {
352352
const cacheKey = buildCacheKey(componentTypes);
353-
return getOrComputeCache(this.componentDataSourcesCache, cacheKey, () =>
353+
return getOrCompute(this.componentDataSourcesCache, cacheKey, () =>
354354
componentTypes.map((compType) => this.getComponentDataSource(compType)),
355355
);
356356
}

src/core/world.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ComponentChangeset } from "../commands/changeset";
22
import { CommandBuffer, type Command } from "../commands/command-buffer";
33
import { serializeQueryFilter, type QueryFilter } from "../query/filter";
44
import { Query } from "../query/query";
5-
import { getOrCreateWithSideEffect } from "../utils/utils";
5+
import { getOrCompute } from "../utils/utils";
66
import { Archetype, MISSING_COMPONENT } from "./archetype";
77
import { hasWildcardRelation } from "./archetype-helpers";
88
import { EntityBuilder } from "./builder";
@@ -1203,7 +1203,7 @@ export class World {
12031203
const sortedTypes = regularTypes.sort((a, b) => a - b);
12041204
const hashKey = this.createArchetypeSignature(sortedTypes);
12051205

1206-
return getOrCreateWithSideEffect(this.archetypeBySignature, hashKey, () => this.createNewArchetype(sortedTypes));
1206+
return getOrCompute(this.archetypeBySignature, hashKey, () => this.createNewArchetype(sortedTypes));
12071207
}
12081208

12091209
private createNewArchetype(componentTypes: EntityId<any>[]): Archetype {

src/utils/utils.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,3 @@ export function getOrCompute<K, V>(cache: Map<K, V>, key: K, compute: () => V):
1717
}
1818
return value;
1919
}
20-
21-
/**
22-
* Alias for getOrCompute - maintained for backwards compatibility
23-
* @deprecated Use getOrCompute instead
24-
*/
25-
export const getOrComputeCache = getOrCompute;
26-
27-
/**
28-
* Alias for getOrCompute - maintained for backwards compatibility
29-
* @deprecated Use getOrCompute instead
30-
*/
31-
export const getOrCreateWithSideEffect = getOrCompute;

0 commit comments

Comments
 (0)