Repository: streamlit/streamlit

Issue:
Bokeh Sliders cause JS errors in browser console
### Checklist

- [X] I have searched the [existing issues](https://github.com/streamlit/streamlit/issues) for similar issues.
- [X] I added a very descriptive title to this issue.
- [X] I have provided sufficient information below to help reproduce this issue.

### Summary

Hi there, I'm trying to use bokeh sliders with streamlit, but they do not show up on the screen and there are error messages in the console that say:

```
6737.20dd8dd6.chunk.js:2 Uncaught (in promise) Error: Model 'Slider' does not exist. This could be due to a widget or a custom model not being registered before first usage.
    at e.value (6737.20dd8dd6.chunk.js:2:29524)
    at Function.value (6737.20dd8dd6.chunk.js:2:22967)
    at Function.value (6737.20dd8dd6.chunk.js:2:23199)
    at Function.value (6737.20dd8dd6.chunk.js:2:27837)
    at 6737.20dd8dd6.chunk.js:2:10184
    at d (main.dccfd6b5.js:2:3574479)
    at Generator.<anonymous> (main.dccfd6b5.js:2:3575822)
    at Generator.next (main.dccfd6b5.js:2:3574842)
    at r (main.dccfd6b5.js:2:3567770)
    at u (main.dccfd6b5.js:2:3567973)
```

### Reproducible Code Example

```Python
import numpy as np
import streamlit as st

from bokeh.layouts import column, row
from bokeh.models import ColumnDataSource, CustomJS, Slider
from bokeh.plotting import figure, show

x = np.linspace(0, 10, 500)
y = np.sin(x)

source = ColumnDataSource(data=dict(x=x, y=y))

plot = figure(y_range=(-10, 10), width=400, height=400)

plot.line('x', 'y', source=source, line_width=3, line_alpha=0.6)

amp = Slider(start=0.1, end=10, value=1, step=.1, title="Amplitude")
freq = Slider(start=0.1, end=10, value=1, step=.1, title="Frequency")
phase = Slider(start=-6.4, end=6.4, value=0, step=.1, title="Phase")
offset = Slider(start=-9, end=9, value=0, step=.1, title="Offset")

callback = CustomJS(args=dict(source=source, amp=amp, freq=freq, phase=phase, offset=offset),
                    code="""
    const A = amp.value
    const k = freq.value
    const phi = phase.value
    const B = offset.value

    const x = source.data.x
    const y = Array.from(x, (x) => B + A*Math.sin(k*x+phi))
    source.data = { x, y }
""")

amp.js_on_change('value', callback)
freq.js_on_change('value', callback)
phase.js_on_change('value', callback)
offset.js_on_change('value', callback)

st.bokeh_chart(row(plot, column(amp, freq, phase, offset)))
```


### Steps To Reproduce

`streamlit run test.py`

### Expected Behavior

Something like this shows up https://docs.bokeh.org/en/3.1.0/docs/examples/interaction/js_callbacks/slider.html

### Current Behavior

"Error: Model 'Slider' does not exist. This could be due to a widget or a custom model not being registered before first usage."

### Is this a regression?

- [X] Yes, this used to work in version `1.23.0`

### Debug info

- Streamlit version: 1.25.0
- Python version: 3.9.13
- Operating System: MacOS
- Browser: Chrome


### Additional Information

_No response_


Discussion:
I was able to reproduce this with Bokeh version 2.4.3 and Streamlit version 1.25.0
Adding confirmation label to this but I did not reproduce this myself. 
Reproduced & isolated error to [Feature/st lib](https://github.com/streamlit/streamlit/commit/add33a681546552954a6cf46cfa384cc32d1cb9b) commit

Resolving patch:
diff --git a/e2e/scripts/st_bokeh_chart.py b/e2e_playwright/st_bokeh_chart.py
similarity index 52%
rename from e2e/scripts/st_bokeh_chart.py
rename to e2e_playwright/st_bokeh_chart.py
--- a/e2e/scripts/st_bokeh_chart.py
+++ b/e2e_playwright/st_bokeh_chart.py
@@ -12,6 +12,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import numpy as np
+from bokeh.layouts import column, row
+from bokeh.models import ColumnDataSource, CustomJS, Slider
 from bokeh.plotting import figure
 
 import streamlit as st
@@ -38,3 +41,38 @@
 
 with col2:
     st.bokeh_chart(right_chart, use_container_width=True)
+
+x = np.linspace(0, 10, 500)
+y = np.sin(x)
+
+source = ColumnDataSource(data=dict(x=x, y=y))
+
+plot = figure(y_range=(-10, 10), width=400, height=400)
+
+plot.line("x", "y", source=source, line_width=3, line_alpha=0.6)
+
+amp = Slider(start=0.1, end=10, value=1, step=0.1, title="Amplitude")
+freq = Slider(start=0.1, end=10, value=1, step=0.1, title="Frequency")
+phase = Slider(start=-6.4, end=6.4, value=0, step=0.1, title="Phase")
+offset = Slider(start=-9, end=9, value=0, step=0.1, title="Offset")
+
+callback = CustomJS(
+    args=dict(source=source, amp=amp, freq=freq, phase=phase, offset=offset),
+    code="""
+    const A = amp.value
+    const k = freq.value
+    const phi = phase.value
+    const B = offset.value
+
+    const x = source.data.x
+    const y = Array.from(x, (x) => B + A*Math.sin(k*x+phi))
+    source.data = { x, y }
+""",
+)
+
+amp.js_on_change("value", callback)
+freq.js_on_change("value", callback)
+phase.js_on_change("value", callback)
+offset.js_on_change("value", callback)
+
+st.bokeh_chart(row(plot, column(amp, freq, phase, offset)))


Test patch:
diff --git a/e2e_playwright/st_bokeh_chart_test.py b/e2e_playwright/st_bokeh_chart_test.py
new file mode 100644
--- /dev/null
+++ b/e2e_playwright/st_bokeh_chart_test.py
@@ -0,0 +1,28 @@
+# Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from playwright.sync_api import Page, expect
+
+
+def test_bokeh_chart(themed_app: Page):
+    """Test that st.bokeh_chart renders correctly."""
+    bokeh_chart_elements = themed_app.locator("[data-testid=stBokehChart]")
+    expect(bokeh_chart_elements).to_have_count(4)
+
+    expect(bokeh_chart_elements.nth(0).locator("canvas").nth(0)).to_be_visible()
+    expect(bokeh_chart_elements.nth(1).locator("canvas").nth(0)).to_be_visible()
+    expect(bokeh_chart_elements.nth(2).locator("canvas").nth(0)).to_be_visible()
+
+    # show a bokeh slider
+    expect(bokeh_chart_elements.nth(3).locator("canvas").nth(0)).to_be_visible()