Skip to content

Commit 9efe26c

Browse files
fix: wrong data-base-url caused chunks and assets in extensions to fail
This for instance broke ipyaggrid >=0.5.2 due to changes in #805
1 parent 9862192 commit 9efe26c

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

packages/solara-meta/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ dev = [
6262
"python-dotenv",
6363
"bqplot",
6464
"bqplot-image-gl",
65+
"ipyaggrid",
6566
"ipyreact; python_version > '3.6'",
6667
"vaex-core",
6768
"vaex-hdf5",

solara/server/templates/solara.html.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@
172172
</script>
173173
{% endraw -%}
174174

175-
<body data-base-url="{{root_path}}/static/">
175+
<body data-base-url="{{root_path}}/jupyter/">
176176
{% if perform_check %}
177177
<iframe src="https://solara.dev/static/public/success.html?system=solara&check=html&version={{solara_version}}" style="display: none"></iframe>
178178
{% endif %}

tests/integration/widget_test.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,43 @@ def change_description(obj):
2727
assert_solara_snapshot(page_session.locator("text=Tested event").screenshot(), postfix="-ipyvuetify3" if solara.util.ipyvuetify_major_version == 3 else "")
2828

2929

30+
def test_widget_ipyaggrid(solara_test, page_session: playwright.sync_api.Page):
31+
# ipyaggrid >=0.5.2 uses the data-base-url on body
32+
# introduced in https://github.com/widgetti/ipyaggrid/pull/64
33+
# which we broke in https://github.com/widgetti/solara/pull/805 since
34+
# we changed the nbextensions path, but didn't update the data-base-url
35+
import ipyaggrid
36+
37+
cars = [
38+
{"carName": "Chevelle", "origin": "US", "make": "Chevrolet", "price": 30415},
39+
{"carName": "Skylark 320", "origin": "US", "make": "Buick", "price": 21042},
40+
{"carName": "PL411", "origin": "Asia", "make": "Datsun", "price": 27676},
41+
]
42+
column_defs = [{"field": c} for c in cars[0]]
43+
44+
grid_options = {
45+
"columnDefs": column_defs,
46+
}
47+
g = ipyaggrid.Grid(grid_data=cars, grid_options=grid_options)
48+
49+
watermark_detected = False
50+
51+
def log(msg):
52+
if "All AG Grid Enterprise features are unlocked" in msg.text:
53+
nonlocal watermark_detected
54+
watermark_detected = True
55+
56+
page_session.on("console", log)
57+
58+
display(g)
59+
60+
cell = page_session.locator(".ag-root-wrapper >> text=Chevrolet")
61+
cell.click()
62+
cell.wait_for()
63+
assert watermark_detected
64+
page_session.remove_listener("console", log)
65+
66+
3067
def test_solara_button_all(ipywidgets_runner, page_session: playwright.sync_api.Page, request, assert_solara_snapshot):
3168
if request.node.callspec.params["ipywidgets_runner"] != "solara" and request.node.callspec.params["solara_server"] != SERVERS[0]:
3269
pytest.skip("No need to run this test for all servers.")

0 commit comments

Comments
 (0)