Repeat calls to third.load.<x> crash. (Cache is trying to use cache payload as url) · Issue #398 · enable3d/enable3d · GitHub
Skip to content

Repeat calls to third.load.<x> crash. (Cache is trying to use cache payload as url) #398

Description

@zvodd

Describe the bug
When loading a GLTF or other files through the three graphics package.
The function that queries the cache, supplies the cached binary array to this.gltfLoader.load instead of the url.

e.g.

  public gltf(url: string): Promise<GLTF> { 
    // if the cache has a value this resolves to the payload and key becomes a big byte array
    const key = this.cache.get(url)
    url = key ? key : url

    return new Promise(resolve => {
      this.gltfLoader.load(url, (gltf: GLTF) => {
        resolve(gltf)
      })
    })
  }

This means a second call to load the same file, hits an exception when it gets a byte array instead of a url string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions