Skip to content

fix: retry an environment or skybox URL after a failed load - #5197

Merged
diegoteran merged 1 commit into
google:masterfrom
Arthur031221:fix-skybox-cache-retry
Oct 1, 2026
Merged

diegoteran merged 1 commit into
google:masterfrom
Arthur031221:fix-skybox-cache-retry

Conversation

@Arthur031221

Copy link
Copy Markdown
Contributor

Reference Issue

No existing issue.

Anyone who sets skybox-image or environment-image to a URL that fails once (a dropped connection, a temporary 404 or CDN error) never gets that URL to load again on the page: TextureUtils caches the load promise per URL and kept the rejected promise, so every later request for the same URL rejected immediately without fetching. Fixing the server or setting the attribute again did not help until the page was reloaded.

The fix removes the cache entry when the load rejects, only if it is still the entry for that load. Successful loads are cached as before.

The new test in TextureUtils-spec.ts makes the first loadEquirect call fail and checks that a second generateEnvironmentMapAndSkybox call with the same URL loads. Without the change the second call rethrows the first error (Error: network error); with it the 14 tests in that spec pass. clang-format reports no changes for the two files.

TextureUtils cached the load promise per URL and kept it when the load
rejected, so a skybox-image or environment-image URL that failed once
(network error, temporary 404) failed again on every later request until
the page was reloaded. Drop the cache entry when the load fails.

@diegoteran diegoteran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@diegoteran diegoteran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@diegoteran
diegoteran merged commit bdd37b8 into google:master Oct 1, 2026
8 checks passed
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.

2 participants