Skip to content

Commit 8d6fb2f

Browse files
feat: on disconnect+reconnect force a page reload
1 parent 88a89c4 commit 8d6fb2f

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

solara/server/server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ def include_js(path: str, module=False) -> Markup:
392392
"path": path,
393393
"root_path": root_path,
394394
"jupyter_root_path": jupyter_root_path,
395+
"force_refresh": settings.theme.force_refresh,
395396
"resources": resources,
396397
"theme": settings.theme.dict(),
397398
"production": settings.main.mode == "production",

solara/server/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ class ThemeSettings(BaseSettings):
3939
loader: str = "solara"
4040
show_banner: bool = True
4141
title: str = "Solara ☀️"
42+
force_refresh: bool = False
4243

4344
class Config:
4445
env_prefix = "solara_theme_"

solara/server/templates/solara.html.j2

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@
245245
solara.rootPath = {{ root_path | tojson | safe}};
246246
solara.jupyterRootPath = {{ jupyter_root_path | tojson | safe}};
247247
solara.cdn = {{ cdn | tojson | safe }};
248+
solara.forceRefresh = {{ force_refresh | tojson | safe }};
248249
// the vue templates expect it to not have a trailing slash
249250
solara.cdn = solara.cdn.replace(/\/$/, '');
250251
// keep this for backwards compatibility
@@ -364,7 +365,9 @@
364365
}
365366
},
366367
needsRefresh: function (value) {
367-
if (this.needsRefresh && !this.cancelAutoRefresh && !solara.production) {
368+
if(solara.forceRefresh) {
369+
this.reload();
370+
} else if (this.needsRefresh && !this.cancelAutoRefresh && !solara.production) {
368371
console.log('value for needRefresh', value);
369372
setTimeout(() => {
370373
console.log('this.autoRefreshCount', this.autoRefreshCount)

0 commit comments

Comments
 (0)