-
-
Notifications
You must be signed in to change notification settings - Fork 710
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
TypeError: Cannot read properties of undefined (reading 'sky') #4340
Comments
Why calling redraw before the style is loaded? |
We do this in https://github.com/geoblocks/ol-maplibre-layer . More precisely we call redraw on each render frame. |
What is weird, is |
I wanted sky to alway be initialized to avoid these if statements. stylesheet.sky is the sky specification and not the sky object... |
See here: |
ah ok so may be just a beffer "if" condition will get rid of the error without changing anything to the logic:
|
That might work 😃 I have no real objections. |
I faced similar error using |
We have tested old styles that obviously don't have sky properties, and they work. |
@HarelM thanks for the response! So I noticed downgrading its version to 4.5.1 solves the issue. |
This feature was introduced as part of 4.5.0 version, downgrading to previous versions will probably solve this. |
We hit the same issue in our application. Where we manage custom 3d layers synchronisation, after creating/deleting the custom layers we call |
I've also bumped into this issue just now. I had no time to carefully investigate it yet, but it feels like it happens reliably when the map component is removed from DOM. I am also using this library indirectly, through https://github.com/visgl/react-map-gl — it as well might be a bug there. |
|
Can we get this patched ASAP? Do you want me to create a PR? |
Please open a PR, yes. |
Here you are: #4431 |
The error comes from the line https://github.com/maplibre/maplibre-gl-js/blob/main/src/render/painter.ts#L412
The stylesheet object doesn't exist when we call
map.redraw()
before the style is loaded. I guess the line should bemaplibre-gl-js version: 4.5.0
browser: all
Steps to Trigger Behavior
Link to Demonstration
https://codepen.io/oterral/pen/PovvbJx
Expected Behavior
No error about sky property
Actual Behavior
A TypeError is triggered in the console
The text was updated successfully, but these errors were encountered: