bokeh / bokeh

Interactive Data Visualization in the browser, from Python

Home Page:https://bokeh.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] JS errors on Bokeh docs page

cdeil opened this issue · comments

Software versions

See your docs build

Browser name and version

Chrome Version 123.0.6312.59 (Official Build) (arm64)

Expected behavior

Docs page search field works

Observed behavior

Docs page search field in top right doesn't work.

Example code

Stack traceback or browser console output

custom.js?v=22a1fd09:11 Uncaught ReferenceError: $ is not defined
    at custom.js?v=22a1fd09:11:1
(anonymous) @ custom.js?v=22a1fd09:11
pydata-sphinx-theme.js:54 [PST]: Changed to light mode using the light theme.
pydata-sphinx-theme.js:570 Uncaught (in promise) TypeError: Cannot read properties of null (reading 'classList')
    at T (pydata-sphinx-theme.js:570:5)
    at r (mixin.js:11:41)
    at pydata-sphinx-theme.js:584:1
T @ pydata-sphinx-theme.js:570
r @ mixin.js:11
(anonymous) @ pydata-sphinx-theme.js:584
await in (anonymous) (async)
c.a @ async module:49
937 @ pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae:1
c @ bootstrap:19
(anonymous) @ startup:4
(anonymous) @ pydata-sphinx-theme.js?digest=8d27b9dea8ad943066ae:1
pydata-sphinx-theme.js:200 Uncaught TypeError: Cannot read properties of null (reading 'querySelector')
    at c (pydata-sphinx-theme.js:200:17)
    at pydata-sphinx-theme.js:237:19
c @ pydata-sphinx-theme.js:200
(anonymous) @ pydata-sphinx-theme.js:237

Screenshots

Screenshot 2024-03-31 at 10 15 29

This is some issue with the Sphinx theme, not Bokeh itself.

@choldgraf any thoughts on what could be going amiss (or who is the best person to ask these days)?

cc @tcmetzger

I'd recommend opening an issue in the pydata-sphinx-theme repository in case it's a problem over there. It looks like the HTML structure has changed and the JS selector didn't change to accommodate it, but I haven't been following the development too closely so don't know where the problem may be

@mosc9575 before we make an issue over there, do you have any bandwidth for a quick look? Does this reproduce locally, and if so does a simple change like updating the theme version fix things?

Only the search button on the start page is broken. The button works on other pages like first steps and gallery and I don't understand why. I also think that the posted JS error is unrelated, because it also appears on pages with working search button.

The error in the browser console comes from the version banner and I don't know how to fix it. See

// Display a version warning banner if necessary
$(document).ready(function () {
const randid = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
$.getJSON('/switcher.json?v=' + randid , function (data) {
// old versions have a unified latest/x.y.z, things are split starting with 3.0
if (BOKEH_CURRENT_VERSION != data[1].version) {
let msg
if (data.findIndex((elt) => elt.version == BOKEH_CURRENT_VERSION) < 0 ) {
msg = "DEVELOPMENT / PRE-RELEASE"
} else {
msg = "PREVIOUS RELEASE"
}
const content = $('<div class="version-alert">This page is documentation for a ' + msg + ' version. For the latest release, go to <a href="https://docs.bokeh.org/en/latest/">https://docs.bokeh.org/en/latest/</a></div>')
$('#banner').append(content);
}
})
})

I also build the docs on my local machine with pydata-sphinx-theme 0.15.2 and 0.15.3dev0 and I can't see if it works, because the search button is broken for local pages. There is an older issue 1654 which could be related.

Just noting that I believe version warning banners are now built into the theme, so you could try using that and see if that removes the error

https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/announcements.html#version-warning-banners

Still the same error. Re-open and close when it's fixed?

@cdeil issues are closed when fixes are merged, which does not mean the fix is published in any release yet.