SymbolixAU / mapdeck

R interface to Deck.gl and Mapbox
https://symbolixau.github.io/mapdeck/articles/mapdeck.html
362 stars 40 forks source link

Maps do not render in current macOS Safari #347

Closed dwachsmuth closed 2 years ago

dwachsmuth commented 3 years ago

Describe the bug I am completely unable to get any mapdeck maps to display in the current version of Safari (15.1, running on macOS Monterey 12.0.1).

To Reproduce

library(sf)
library(mapdeck)

nc <- st_read(system.file("shape/nc.shp", package="sf"))
mapdeck() |> 
  add_polygon(nc)

Expected behaviour In the RStudio viewer, this launches a map of NC, as expected. Opening the localhost session in Chrome produces the same result. But opening the session in Safari produces a blank window.

Screenshots Output in RStudio:

Screen Shot 2021-11-17 at 16 32 08

Output in Safari:

Screen Shot 2021-11-17 at 16 33 09

Versions I'm on mapdeck 0.3.4, on R 4.1.1, on macOS 12.0.1. I have verified that this bug exists on two separate Macs running the same stack.

Other notes I encountered this bug in the context of a very complex Shiny app I develop that uses mapdeck extensively; in the course of trying to find a minimal reprex, I realized that every single map failed to render. I don't have access to older versions of macOS/Safari, but a colleague was able to use our Shiny app with no problems on Safari 14.1.2, running on macOS Mojave. I am reasonably confident that the bug arrived in Safari 15, although I'm not sure exactly when, since I hadn't been working on the web-deployed version of our Shiny app in the past few months.

dwachsmuth commented 3 years ago

Sorry, I should have added: the Safari dev console throws up dozens of errors as soon as I load the page. Here is one of them (I think they are all the same, but I haven't checked every single one):

WebGL: INVALID_OPERATION: useProgram: program not valid
useProgram
useProgram
(anonymous function) — deckgl.min.js:1:26966
value — deckgl.min.js:11:704333
value — deckgl.min.js:11:124255
value — deckgl.min.js:1:309438
(anonymous function) — deckgl.min.js:1:296158
nt — deckgl.min.js:1:29116
value — deckgl.min.js:1:295834
value — deckgl.min.js:1:238971
value — deckgl.min.js:1:237512
value — deckgl.min.js:11:90595
value — deckgl.min.js:11:223270
value — deckgl.min.js:11:218515
value — deckgl.min.js:11:224007
value
value — deckgl.min.js:11:197080
value — deckgl.min.js:11:194249
e — deckgl.min.js:11:196242
deckgl.min.js:1:26966
dcooley commented 3 years ago

Judging by those error logs, and the fact it runs in other browsers, this looks like it's a compatability issue between Safari and Deck.gl; have you checkd the deck.gl issue tracker to see if there's anything there?

dwachsmuth commented 3 years ago

Good suggestion; I checked their issue tracker and found discussion of a big performance regression in a previous version of Safari from the summer, but nothing more recent, and definitely nothing about maps completely failing to render.

dcooley commented 3 years ago

Does a pure deck.gl-only example work for you? e.g. - https://jsfiddle.net/symbolixau/on7432fj/70/

dwachsmuth commented 3 years ago

No! The basemap loads, but the rainbow polygons do not. (All works fine in Chrome.)

I can take this over to the deck.gl side and see what they can make of it. I don't have any experience with deck.gl except via mapdeck—would you suggest I give them your example as a reasonably minimal reprex?

dcooley commented 3 years ago

would you suggest I give them your example as a reasonably minimal reprex?

yes, plus the error logs should be enough to start them debugging

dwachsmuth commented 3 years ago

Great, many thanks!

dwachsmuth commented 2 years ago

After some back and forth (https://github.com/visgl/deck.gl/issues/6414#issuecomment-996182720), the deck.gl contributor concluded that this problem comes from mapdeck depending on an old version of deck.gl, if I understand things correctly.

dcooley commented 2 years ago

I've updated the fiddle to use the latest deck.gl library; let me know if this is working for you and if so I'll update mapdeck accordingly.

dwachsmuth commented 2 years ago

Works like a charm!

Screen Shot 2021-12-16 at 20 52 18
dcooley commented 2 years ago

ok now try the latest mapdeck

remotes::install_github("SymbolixAU/mapdeck")
dwachsmuth commented 2 years ago

Yup, my test project works just fine now!

dcooley commented 2 years ago

cool - safe to close this issue?

(I probably won't get this updated on CRAN any time soon, however.)

dwachsmuth commented 2 years ago

Yup, thanks a lot!