@@ -34,26 +34,8 @@ export function structuredActivityComponent<
3434 loading ?: Loading < InferActivityParams < ActivityName > > ;
3535 errorHandler ?: ErrorHandler < InferActivityParams < ActivityName > > ;
3636} ) : StructuredActivityComponentType < InferActivityParams < ActivityName > > {
37- const content = options . content ;
38- let cachedContent : SyncInspectablePromise < {
39- default : Content < InferActivityParams < ActivityName > > ;
40- } > | null = null ;
41-
4237 return {
4338 ...options ,
44- content :
45- typeof content !== "function"
46- ? content
47- : ( ) => {
48- if (
49- ! cachedContent ||
50- inspect ( cachedContent ) . status === PromiseStatus . REJECTED
51- ) {
52- cachedContent = resolve ( content ( ) ) ;
53- }
54-
55- return cachedContent ;
56- } ,
5739 [ STRUCTURED_ACTIVITY_COMPONENT_TYPE ] : true ,
5840 } ;
5941}
@@ -80,17 +62,17 @@ export function content<ActivityName extends RegisteredActivityName>(
8062
8163const ContentComponentMap = new WeakMap <
8264 StructuredActivityComponentType < { } > ,
83- Content < { } > [ "component" ]
65+ { Component : Content < { } > [ "component" ] ; preload : ( ) => Promise < void > }
8466> ( ) ;
8567
8668export function getContentComponent (
8769 structuredActivityComponent : StructuredActivityComponentType < { } > ,
88- ) : Content < { } > [ "component" ] {
70+ ) : { Component : Content < { } > [ "component" ] ; preload : ( ) => Promise < void > } {
8971 if ( ContentComponentMap . has ( structuredActivityComponent ) ) {
9072 return ContentComponentMap . get ( structuredActivityComponent ) ! ;
9173 }
9274
93- const { Component : ContentComponent } = preloadableLazyComponent ( ( ) => {
75+ const { Component, preload } = preloadableLazyComponent ( ( ) => {
9476 const content = structuredActivityComponent . content ;
9577 const contentPromise = resolve (
9678 typeof content === "function" ? content ( ) : { default : content } ,
@@ -112,9 +94,9 @@ export function getContentComponent(
11294 ) ;
11395 } ) ;
11496
115- ContentComponentMap . set ( structuredActivityComponent , ContentComponent ) ;
97+ ContentComponentMap . set ( structuredActivityComponent , { Component , preload } ) ;
11698
117- return ContentComponent ;
99+ return { Component , preload } ;
118100}
119101
120102export interface Layout < P extends { } > {
0 commit comments