1
1
/** @file Public APIs for the SSR */
2
2
3
+ // @ts -expect-error we don't have types for the preloader
4
+ import { p as preload } from '@qwik.dev/core/preloader' ;
3
5
import { assertTrue } from '../shared/error/assert' ;
4
6
import { QError , qError } from '../shared/error/error' ;
5
7
import { ERROR_CONTEXT , isRecoverable } from '../shared/error/error-handling' ;
6
- import { type QRLInternal } from '../shared/qrl/qrl-class' ;
7
8
import type { QRL } from '../shared/qrl/qrl.public' ;
8
- import { ChoreType } from '../shared/util-chore-type' ;
9
9
import { _SharedContainer } from '../shared/shared-container' ;
10
10
import {
11
11
getObjectById ,
@@ -21,21 +21,21 @@ import {
21
21
ELEMENT_SEQ ,
22
22
ELEMENT_SEQ_IDX ,
23
23
OnRenderProp ,
24
+ QBackRefs ,
24
25
QBaseAttr ,
25
26
QContainerAttr ,
26
27
QContainerSelector ,
27
28
QCtxAttr ,
28
29
QInstanceAttr ,
30
+ QLocaleAttr ,
31
+ QManifestHashAttr ,
29
32
QScopedStyle ,
30
33
QSlotParent ,
31
34
QStyle ,
32
35
QStyleSelector ,
33
- QBackRefs ,
34
36
Q_PROPS_SEPARATOR ,
35
37
USE_ON_LOCAL_SEQ_IDX ,
36
38
getQFuncs ,
37
- QLocaleAttr ,
38
- QManifestHashAttr ,
39
39
} from '../shared/utils/markers' ;
40
40
import { isSlotProp } from '../shared/utils/prop' ;
41
41
import { qDev } from '../shared/utils/qdev' ;
@@ -55,6 +55,7 @@ import {
55
55
type VNode ,
56
56
type VirtualVNode ,
57
57
} from './types' ;
58
+ import { mapArray_get , mapArray_has , mapArray_set } from './util-mapArray' ;
58
59
import {
59
60
VNodeJournalOpCode ,
60
61
vnode_applyJournal ,
@@ -72,7 +73,6 @@ import {
72
73
vnode_setProp ,
73
74
type VNodeJournal ,
74
75
} from './vnode' ;
75
- import { mapArray_get , mapArray_has , mapArray_set } from './util-mapArray' ;
76
76
77
77
/** @public */
78
78
export function getDomContainer ( element : Element | VNode ) : IClientContainer {
@@ -117,7 +117,7 @@ export class DomContainer extends _SharedContainer implements IClientContainer {
117
117
public $qFuncs$ : Array < ( ...args : unknown [ ] ) => unknown > ;
118
118
public $instanceHash$ : string ;
119
119
public $forwardRefs$ : Array < number > | null = null ;
120
- public $initialQRLsIndexes $ : Array < number > | null = null ;
120
+ public $initialQRLs $ : Array < string > | null = null ;
121
121
public vNodeLocate : ( id : string | Element ) => VNode = ( id ) => vnode_locate ( this . rootVNode , id ) ;
122
122
123
123
private $stateData$ : unknown [ ] ;
@@ -359,15 +359,14 @@ export class DomContainer extends _SharedContainer implements IClientContainer {
359
359
* ```
360
360
*/
361
361
private $scheduleInitialQRLs$ ( ) : void {
362
- if ( this . $initialQRLsIndexes$ ) {
363
- for ( const index of this . $initialQRLsIndexes$ ) {
364
- this . $scheduler$ (
365
- ChoreType . QRL_RESOLVE ,
366
- null ,
367
- this . $getObjectById$ ( index ) as QRLInternal < ( ...args : unknown [ ] ) => unknown >
368
- ) ;
362
+ if ( this . $initialQRLs$ ) {
363
+ for ( const qrl of this . $initialQRLs$ ) {
364
+ const match = / # ( .* ) _ ( [ a - z A - Z 0 - 9 ] + ) ( \[ | $ ) / . exec ( qrl ) ;
365
+ if ( match ) {
366
+ preload ( match [ 2 ] , 0.3 ) ;
367
+ }
369
368
}
370
- this . $initialQRLsIndexes $ = null ;
369
+ this . $initialQRLs $ = null ;
371
370
}
372
371
}
373
372
}
0 commit comments