File tree 4 files changed +18
-0
lines changed
svelte/src/lib/components
4 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ interface BaseInertiaLinkProps {
32
32
onSuccess ?: ( ) => void
33
33
onError ?: ( ) => void
34
34
queryStringArrayFormat ?: 'indices' | 'brackets'
35
+ async : boolean
35
36
}
36
37
37
38
export type InertiaLinkProps = BaseInertiaLinkProps &
@@ -53,6 +54,7 @@ const Link = forwardRef<unknown, InertiaLinkProps>(
53
54
except = [ ] ,
54
55
headers = { } ,
55
56
queryStringArrayFormat = 'brackets' ,
57
+ async = false ,
56
58
onClick = noop ,
57
59
onCancelToken = noop ,
58
60
onBefore = noop ,
@@ -82,6 +84,7 @@ const Link = forwardRef<unknown, InertiaLinkProps>(
82
84
only,
83
85
except,
84
86
headers,
87
+ async,
85
88
onCancelToken,
86
89
onBefore,
87
90
onStart,
@@ -103,6 +106,7 @@ const Link = forwardRef<unknown, InertiaLinkProps>(
103
106
only ,
104
107
except ,
105
108
headers ,
109
+ async ,
106
110
onClick ,
107
111
onCancelToken ,
108
112
onBefore ,
Original file line number Diff line number Diff line change 14
14
export let except: string [] = []
15
15
export let headers: Record <string , string > = {}
16
16
export let queryStringArrayFormat: ' brackets' | ' indices' = ' brackets'
17
+ export let async: boolean = false
17
18
18
19
beforeUpdate (() => {
19
20
if (as === ' a' && method .toLowerCase () !== ' get' ) {
38
39
except ,
39
40
headers ,
40
41
queryStringArrayFormat ,
42
+ async ,
41
43
}}
42
44
{...as === ' a' ? { href } : {}}
43
45
{...$$restProps }
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ export interface InertiaLinkProps {
29
29
onCancel ?: ( ) => void
30
30
onSuccess ?: ( ) => void
31
31
queryStringArrayFormat ?: 'brackets' | 'indices'
32
+ async : boolean
32
33
}
33
34
34
35
type InertiaLink = FunctionalComponentOptions < InertiaLinkProps >
@@ -79,6 +80,10 @@ const Link: InertiaLink = {
79
80
type : String as PropType < 'brackets' | 'indices' > ,
80
81
default : 'brackets' ,
81
82
} ,
83
+ async : {
84
+ type : Boolean ,
85
+ default : false ,
86
+ } ,
82
87
} ,
83
88
render ( h , { props, data, children } ) {
84
89
data . on = {
@@ -134,6 +139,7 @@ const Link: InertiaLink = {
134
139
only : props . only ,
135
140
except : props . except ,
136
141
headers : props . headers ,
142
+ async : props . async ,
137
143
// @ts -expect-error
138
144
onCancelToken : data . on . cancelToken ,
139
145
// @ts -expect-error
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export interface InertiaLinkProps {
21
21
onCancel ?: ( ) => void
22
22
onSuccess ?: ( ) => void
23
23
queryStringArrayFormat ?: 'brackets' | 'indices'
24
+ async : boolean
24
25
}
25
26
26
27
type InertiaLink = DefineComponent < InertiaLinkProps >
@@ -72,6 +73,10 @@ const Link: InertiaLink = defineComponent({
72
73
type : String as PropType < 'brackets' | 'indices' > ,
73
74
default : 'brackets' ,
74
75
} ,
76
+ async : {
77
+ type : Boolean ,
78
+ default : false ,
79
+ } ,
75
80
} ,
76
81
setup ( props , { slots, attrs } ) {
77
82
return ( ) => {
@@ -103,6 +108,7 @@ const Link: InertiaLink = defineComponent({
103
108
only : props . only ,
104
109
except : props . except ,
105
110
headers : props . headers ,
111
+ async : props . async ,
106
112
// @ts -expect-error
107
113
onCancelToken : attrs . onCancelToken || ( ( ) => ( { } ) ) ,
108
114
// @ts -expect-error
You can’t perform that action at this time.
0 commit comments