jupyter / jupyter-sphinx

Sphinx extension for rendering of Jupyter interactive widgets.
https://jupyter-sphinx.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
186 stars 65 forks source link

Widget renders intermittently #189

Open gjoseph92 opened 2 years ago

gjoseph92 commented 2 years ago

The ipyleaflet map embedded in https://stackstac.readthedocs.io/en/stable/examples/gif.html (it's right above the "Search for STAC items" heading) usually shows up the first time you open the page in a new browser, but subsequent times, usually nothing renders. If you switch to a different version (say, https://stackstac.readthedocs.io/en/v0.2.1/examples/gif.html), you might get it again once.

Maybe related to https://github.com/jupyter/jupyter-sphinx/issues/163#issuecomment-705108142?

Here's what I saw on a successful load: Screen Shot 2021-10-28 at 7 18 46 PM

And unsuccessful: image

On the successful load, you can see it at least tries to load jupyter-leaflet.js from https://stackstac.readthedocs.io/en/v0.2.1/examples/jupyter-leaflet.js, which 404s (because it's not there): Screen Shot 2021-10-28 at 7 20 37 PM

But it then falls back to unpkg and succeeds: Screen Shot 2021-10-28 at 7 20 44 PM

Whereas when nothing shows up, it doesn't even try to load jupyter-leaflet.js.

Could there be some sort of race condition, maybe related to the other failures loading thebelab (or Gumshoe, or the mismatched anonymous define error), where a browser cache miss is giving a script enough time to kick off the JupyterLab load before it fails with one of these other errors? Just a wild guess.

If it helps at all, this is the notebook being rendered (uses a raw restructuredtext cell). And versions are:

jupyter-sphinx = {version = "^0.3.2", optional = true}
Sphinx = {version = "^3.5.4", optional = true}
furo = {version = "^2021.4.11-beta.34", optional = true}
ipywidgets = {version = "^7.6.3", optional = true}
12rambau commented 7 months ago

Hi @gjoseph92, I am myself using jupyter-sphinx a lot with geospatial data and I never experienced what you are describing. I'm always using the pydata-sphinx-theme or the sphinx-book-theme, could you switch your documentation to the latter and let me know if the bug persists ?