mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 02:32:18 +00:00
Read the weather texture limit and the reveal time in the body, not in a parameter default
esbuild compiles an optional method call reached through an optional chain (`a?.b?.()`) in a parameter's default, for browsers it lowers optional chaining for (Chrome and Edge before 91), into code that reads a variable out of its scope. The weather shell's texture limit was read that way, so every satellite frame threw a ReferenceError in the built app and the layer showed "Weather imagery unavailable"; the leader and card reveal took their default time the same way. A test now refuses the form anywhere under src/.
This commit is contained in:
1 parent
7f2dc81cf6
commit
84b60a92e0
3 files changed
+116
-14
No files matched your search
@@ -177,13 +177,20 @@ export function createWeatherShell({
|
||||
drawOf = findDraw,
|
||||
cameraOf = findCamera,
|
||||
frameOf = findFrame,
|
||||
maxTextureSize = rendererOf(viewer)?.quality?.device?.().maxTextureSize ?? 0,
|
||||
maxTextureSize,
|
||||
frameSource = null,
|
||||
}) {
|
||||
if (!Object.hasOwn(WEATHER_IMAGE_SIZES, product))
|
||||
throw new TypeError('Unknown weather product');
|
||||
const size = fitTexture(WEATHER_IMAGE_SIZES[product], maxTextureSize);
|
||||
const detailSize = fitTexture(WEATHER_DETAIL_SIZE, maxTextureSize);
|
||||
// Read in the body, not as the parameter's default: an optional method call
|
||||
// in a default parameter is compiled for older browsers into code that
|
||||
// throws (esbuild).
|
||||
const textureLimit =
|
||||
maxTextureSize === undefined
|
||||
? (rendererOf(viewer)?.quality?.device?.().maxTextureSize ?? 0)
|
||||
: maxTextureSize;
|
||||
const size = fitTexture(WEATHER_IMAGE_SIZES[product], textureLimit);
|
||||
const detailSize = fitTexture(WEATHER_DETAIL_SIZE, textureLimit);
|
||||
const infrared = product === 'clouds' || product === 'clouds-regional';
|
||||
// Global infrared contrast depends on the requested extent, so a window would
|
||||
// not match the image around it; the globe host also shows one mosaic.
|
||||
|
||||
Reference in new issue
Block a user