Skip to content

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented May 12, 2025

Fixed #31083.

Description

The PR fixes a bug in ImageBitmapLoader that can appear when more than one image loader try to load an erroneous URL with enabled caching. In that case, not all onError() callback were executed.

The idea of the PR is to keep track of the error object so it can be used to detect an error situation for duplicated requests.

Copy link

github-actions bot commented May 12, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 337.26
78.64
337.26
78.64
+0 B
+0 B
WebGPU 548.43
152.04
548.43
152.04
+0 B
+0 B
WebGPU Nodes 547.78
151.89
547.78
151.89
+0 B
+0 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 467.33
112.95
467.33
112.95
+0 B
+0 B
WebGPU 623.34
168.78
623.34
168.78
+0 B
+0 B
WebGPU Nodes 578.19
158.07
578.19
158.07
+0 B
+0 B

@ycw
Copy link
Contributor

ycw commented May 12, 2025

Would you mind update the class's jsdoc to clarify the limitation of current implementation:

- /* Also note that unlike {@link FileLoader}, this loader does not avoid multiple concurrent requests to the same URL.
+ /* Also note that unlike {@link FileLoader}, this loader avoids multiple concurrent requests to the same URL only if `Cache` is enabled.

FWIW, FileLoader can achieve this without global Cache

@Mugen87 Mugen87 added this to the r177 milestone May 12, 2025
@ycw
Copy link
Contributor

ycw commented May 12, 2025

Thanks.

@Mugen87 Mugen87 merged commit 3589a12 into mrdoob:dev May 12, 2025
12 checks passed
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* ImageBitmapLoader: Make error handling more robust.

* ImageBitmapLoader: Simplify code.

* ImageBitmapLoader: Improve comment.

* ImageBitmapLoader: Improve docs.
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* ImageBitmapLoader: Make error handling more robust.

* ImageBitmapLoader: Simplify code.

* ImageBitmapLoader: Improve comment.

* ImageBitmapLoader: Improve docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageBitmapLoader Bug: Failed-to-fetch-resource WILL call onLoad callbacks
2 participants