File tree Expand file tree Collapse file tree 5 files changed +6
-18
lines changed
middleware/request-handler Expand file tree Collapse file tree 5 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import { IsQData } from './user-response';
9
9
export interface QData {
10
10
status : number ;
11
11
href : string ;
12
- redirect ?: string ;
13
12
isRewrite ?: boolean ;
14
13
}
15
14
@@ -24,14 +23,12 @@ export async function qDataHandler(requestEv: RequestEvent) {
24
23
}
25
24
26
25
const status = requestEv . status ( ) ;
27
- const redirectLocation = requestEv . headers . get ( 'Location' ) ;
28
26
29
27
requestEv . headers . set ( 'Content-Type' , 'application/json; charset=utf-8' ) ;
30
28
31
29
const qData : QData = {
32
30
status,
33
31
href : getPathname ( requestEv . url ) ,
34
- redirect : redirectLocation ?? undefined ,
35
32
isRewrite : requestEv . sharedMap . get ( RequestEvIsRewrite ) ,
36
33
} ;
37
34
Original file line number Diff line number Diff line change 1
- import type { ClientPageData } from './types' ;
2
1
import type { SerializationStrategy } from '@qwik.dev/core/internal' ;
3
2
4
3
export const MODULE_CACHE = /*#__PURE__*/ new WeakMap < any , any > ( ) ;
5
4
6
- export const CLIENT_DATA_CACHE = new Map < string , Promise < ClientPageData | undefined > > ( ) ;
7
-
8
5
export const QACTION_KEY = 'qaction' ;
9
6
export const QACTION_FORMAT_KEY = 'format' ;
10
7
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ import {
30
30
type SerializationStrategy ,
31
31
} from '@qwik.dev/core/internal' ;
32
32
import { clientNavigate } from './client-navigate' ;
33
- import { CLIENT_DATA_CACHE , DEFAULT_LOADERS_SERIALIZATION_STRATEGY , Q_ROUTE } from './constants' ;
33
+ import { DEFAULT_LOADERS_SERIALIZATION_STRATEGY , Q_ROUTE } from './constants' ;
34
34
import {
35
35
ContentContext ,
36
36
ContentInternalContext ,
@@ -555,7 +555,6 @@ export const useQwikRouter = (props?: QwikRouterProps) => {
555
555
}
556
556
}
557
557
}
558
- CLIENT_DATA_CACHE . clear ( ) ;
559
558
560
559
const win = window as ClientSPAWindow ;
561
560
if ( ! win . _qRouterSPA ) {
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import type {
18
18
} from '@qwik.dev/router/middleware/request-handler' ;
19
19
import type * as v from 'valibot' ;
20
20
import type * as z from 'zod' ;
21
+ import type { QData } from '../../middleware/request-handler/qdata-endpoints' ;
21
22
import type { Q_ROUTE } from './constants' ;
22
23
23
24
export type {
@@ -343,10 +344,9 @@ export interface ClientActionData {
343
344
data : unknown ;
344
345
}
345
346
346
- export interface ClientPageData extends Omit < EndpointResponse , 'loadersSerializationStrategy' > {
347
- href : string ;
348
- redirect ?: string ;
349
- isRewrite ?: boolean ;
347
+ export interface ClientPageData extends QData {
348
+ loaders : Record < string , unknown > ;
349
+ action ?: ClientActionData ;
350
350
}
351
351
352
352
export interface LoaderData {
Original file line number Diff line number Diff line change @@ -85,10 +85,6 @@ export const loadClientData = async (
85
85
location . href = url . href ;
86
86
return ;
87
87
}
88
- if ( clientData . redirect ) {
89
- // server function asked for redirect
90
- location . href = clientData . redirect ;
91
- }
92
88
return clientData ;
93
89
} ) ;
94
90
} else {
@@ -111,8 +107,7 @@ export const loadClientData = async (
111
107
: undefined ,
112
108
href : v ?. href ?? pagePathname ,
113
109
status : v ?. status ?? 200 ,
114
- redirect : v ?. redirect ,
115
- isRewrite : v ?. isRewrite ,
110
+ isRewrite : v ?. isRewrite ?? false ,
116
111
} satisfies ClientPageData ;
117
112
} ) ;
118
113
} ;
You can’t perform that action at this time.
0 commit comments