Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Terrain Lockups in requestTileGeometry due to Promise Handling Inconsistencies #11630

Merged
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
##### Fixes :wrench:

- Corrected JSDoc and Typescript definitions that marked optional arguments as required in `Cesium3dTileset.fromIonAssetId` [#11623](https://github.com/CesiumGS/cesium/issues/11623), and `IonImageryProvider.fromAssetId` [#11624](https://github.com/CesiumGS/cesium/issues/11624)
- Fixed terrain lockups in `requestTileGeometry` by ensuring promise handling aligns with CesiumJS's expectations. [#11630](https://github.com/CesiumGS/cesium/pull/11630)

### 1.111 - 2023-11-01

Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Robert Irving](https://github.com/robert-irving-snc)
- [General Atomics CCRi](https://www.ga-ccri.com/)
- [matthias-ccri](https://github.com/matthias-ccri)
- [Terradepth, Inc.](https://www.terradepth.com/)
- [Marc Johnson](https://github.com/marcejohnson)
- [Jacob Frazer](https://github.com/coderjake91)

## [Individual CLA](Documentation/Contributors/CLAs/individual-contributor-license-agreement-v1.0.pdf)

Expand Down
15 changes: 11 additions & 4 deletions packages/engine/Source/Core/CesiumTerrainProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,11 +897,18 @@ CesiumTerrainProvider.prototype.requestTileGeometry = function (

if (!defined(layerToUse) && unknownAvailability) {
// Try again when availability data is ready– Otherwise the tile will be marked as failed and never re-requested
return availabilityPromise.then(() =>
this.requestTileGeometry(x, y, level, request)
);
return availabilityPromise.then(() => {
// handle promise or undefined return
return new Promise((resolve) => {
// defer execution to the next event loop
setTimeout(() => {
const promise = this.requestTileGeometry(x, y, level, request);
resolve(promise);
}, 0); // next tick
});
});
}

// call overridden function below
return requestTileGeometry(this, x, y, level, layerToUse, request);
};

Expand Down