@@ -2357,6 +2357,7 @@ def router():
2357
2357
Output (_ID_STORE , "data" ),
2358
2358
inputs = inputs ,
2359
2359
prevent_initial_call = True ,
2360
+ use_async = True
2360
2361
)
2361
2362
async def update (pathname_ , search_ , ** states ):
2362
2363
"""
@@ -2383,37 +2384,37 @@ async def update(pathname_, search_, **states):
2383
2384
layout = page .get ("layout" , "" )
2384
2385
title = page ["title" ]
2385
2386
2386
- if callable (layout ):
2387
- layout = await execute_async_function (layout ,
2388
- ** {** (path_variables or {}), ** query_parameters , ** states }
2389
- )
2390
- if callable (title ):
2391
- title = await execute_async_function (title ,
2392
- ** (path_variables or {})
2393
- )
2394
-
2395
- return layout , {"title" : title }
2396
-
2397
- _validate .check_for_duplicate_pathnames (_pages .PAGE_REGISTRY )
2398
- _validate .validate_registry (_pages .PAGE_REGISTRY )
2399
-
2400
- # Set validation_layout
2401
- if not self .config .suppress_callback_exceptions :
2402
- self .validation_layout = html .Div (
2403
- [
2404
- asyncio .run (execute_async_function (page ["layout" ])) if callable (page ["layout" ]) else page [
2405
- "layout" ]
2406
- for page in _pages .PAGE_REGISTRY .values ()
2407
- ]
2408
- + [
2409
- # pylint: disable=not-callable
2410
- self .layout ()
2411
- if callable (self .layout )
2412
- else self .layout
2387
+ if callable (layout ):
2388
+ layout = await execute_async_function (layout ,
2389
+ ** {** (path_variables or {}), ** query_parameters , ** states }
2390
+ )
2391
+ if callable (title ):
2392
+ title = await execute_async_function (title ,
2393
+ ** (path_variables or {})
2394
+ )
2395
+
2396
+ return layout , {"title" : title }
2397
+
2398
+ _validate .check_for_duplicate_pathnames (_pages .PAGE_REGISTRY )
2399
+ _validate .validate_registry (_pages .PAGE_REGISTRY )
2400
+
2401
+ # Set validation_layout
2402
+ if not self .config .suppress_callback_exceptions :
2403
+ self .validation_layout = html .Div (
2404
+ [
2405
+ asyncio .run (execute_async_function (page ["layout" ])) if callable (page ["layout" ]) else page [
2406
+ "layout" ]
2407
+ for page in _pages .PAGE_REGISTRY .values ()
2413
2408
]
2414
- )
2415
- if _ID_CONTENT not in self .validation_layout :
2416
- raise Exception ("`dash.page_container` not found in the layout" )
2409
+ + [
2410
+ # pylint: disable=not-callable
2411
+ self .layout ()
2412
+ if callable (self .layout )
2413
+ else self .layout
2414
+ ]
2415
+ )
2416
+ if _ID_CONTENT not in self .validation_layout :
2417
+ raise Exception ("`dash.page_container` not found in the layout" )
2417
2418
else :
2418
2419
@self .callback (
2419
2420
Output (_ID_CONTENT , "children" ),
@@ -2446,35 +2447,35 @@ def update(pathname_, search_, **states):
2446
2447
layout = page .get ("layout" , "" )
2447
2448
title = page ["title" ]
2448
2449
2449
- if callable (layout ):
2450
- layout = layout (** {** (path_variables or {}), ** query_parameters ,
2451
- ** states })
2452
- if callable (title ):
2453
- title = title (** (path_variables or {}))
2454
-
2455
- return layout , {"title" : title }
2456
-
2457
- _validate .check_for_duplicate_pathnames (_pages .PAGE_REGISTRY )
2458
- _validate .validate_registry (_pages .PAGE_REGISTRY )
2459
-
2460
- # Set validation_layout
2461
- if not self .config .suppress_callback_exceptions :
2462
- self .validation_layout = html .Div (
2463
- [
2464
- page ["layout" ]() if callable (page ["layout" ]) else
2465
- page [
2466
- "layout" ]
2467
- for page in _pages .PAGE_REGISTRY .values ()
2468
- ]
2469
- + [
2470
- # pylint: disable=not-callable
2471
- self .layout ()
2472
- if callable (self .layout )
2473
- else self .layout
2474
- ]
2475
- )
2476
- if _ID_CONTENT not in self .validation_layout :
2477
- raise Exception ("`dash.page_container` not found in the layout" )
2450
+ if callable (layout ):
2451
+ layout = layout (** {** (path_variables or {}), ** query_parameters ,
2452
+ ** states })
2453
+ if callable (title ):
2454
+ title = title (** (path_variables or {}))
2455
+
2456
+ return layout , {"title" : title }
2457
+
2458
+ _validate .check_for_duplicate_pathnames (_pages .PAGE_REGISTRY )
2459
+ _validate .validate_registry (_pages .PAGE_REGISTRY )
2460
+
2461
+ # Set validation_layout
2462
+ if not self .config .suppress_callback_exceptions :
2463
+ self .validation_layout = html .Div (
2464
+ [
2465
+ page ["layout" ]() if callable (page ["layout" ]) else
2466
+ page [
2467
+ "layout" ]
2468
+ for page in _pages .PAGE_REGISTRY .values ()
2469
+ ]
2470
+ + [
2471
+ # pylint: disable=not-callable
2472
+ self .layout ()
2473
+ if callable (self .layout )
2474
+ else self .layout
2475
+ ]
2476
+ )
2477
+ if _ID_CONTENT not in self .validation_layout :
2478
+ raise Exception ("`dash.page_container` not found in the layout" )
2478
2479
2479
2480
# Update the page title on page navigation
2480
2481
self .clientside_callback (
0 commit comments