Skip to content

Commit

Permalink
fix: don't memoize
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Sep 3, 2023
1 parent 7fd16e6 commit 83ae5d1
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions packages/fiber/src/core/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,13 @@ export function useGraph(object: THREE.Object3D) {
return React.useMemo(() => buildGraph(object), [object])
}

const memoizedLoaders = new WeakMap<LoaderProto<any>, Loader<any>>()

function loadingFn<L extends LoaderProto<any>>(
extensions?: Extensions<L>,
onProgress?: (event: ProgressEvent<EventTarget>) => void,
) {
return function (Proto: L, ...input: string[]) {
// Construct new loader and run extensions
let loader = memoizedLoaders.get(Proto)!
if (!loader) {
loader = new Proto()
memoizedLoaders.set(Proto, loader)
}

const loader = new Proto()
if (extensions) extensions(loader)
// Go through the urls and load them
return Promise.all(
Expand Down

0 comments on commit 83ae5d1

Please sign in to comment.