Skip to content
Merged
Prev Previous commit
Next Next commit
wip
  • Loading branch information
pascalbaljet committed Aug 15, 2025
commit 48befdf2ece1a11807677cf834545b863633246e
2 changes: 1 addition & 1 deletion packages/core/src/prefetched.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class PrefetchedRequests {
singleUse: expires === 0,
timestamp: Date.now(),
inFlight: false,
tags: cacheTags,
tags: Array.isArray(cacheTags) ? cacheTags : [cacheTags],
})

this.scheduleForRemoval(params, expires)
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ export class Router {
prefetchedRequests.removeAll()
}

public flushByCacheTags(tags: string[]): void {
prefetchedRequests.removeByTags(tags)
public flushByCacheTags(tags: string | string[]): void {
prefetchedRequests.removeByTags(Array.isArray(tags) ? tags : [tags])
}

public getPrefetching(
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export type Visit<T extends RequestPayload = RequestPayload> = {
fresh: boolean
reset: string[]
preserveUrl: boolean
invalidateCacheTags: string[]
invalidateCacheTags: string | string[]
}

export type GlobalEventsMap<T extends RequestPayload = RequestPayload> = {
Expand Down Expand Up @@ -351,7 +351,7 @@ export type CacheForOption = number | string

export type PrefetchOptions = {
cacheFor: CacheForOption | CacheForOption[]
cacheTags: string[]
cacheTags: string | string[]
}

export interface LinkComponentBaseProps
Expand All @@ -374,7 +374,7 @@ export interface LinkComponentBaseProps
onCancelToken: (cancelToken: import('axios').CancelTokenSource) => void
prefetch: boolean | LinkPrefetchOption | LinkPrefetchOption[]
cacheFor: CacheForOption | CacheForOption[]
cacheTags: string[]
cacheTags: string | string[]
}
> {}

Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/src/components/Link.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
export let async: boolean = false
export let prefetch: boolean | LinkPrefetchOption | LinkPrefetchOption[] = false
export let cacheFor: CacheForOption | CacheForOption[] = 0
export let cacheTags: string[] = []
export let cacheTags: string | string[] = []

$: _method = typeof href === 'object' ? href.method : method
$: _href = typeof href === 'object' ? href.url : href
Expand Down
2 changes: 1 addition & 1 deletion packages/vue3/src/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const Form: InertiaForm = defineComponent({
default: false,
},
invalidateCacheTags: {
type: Array as PropType<FormComponentProps['invalidateCacheTags']>,
type: [String, Array] as PropType<FormComponentProps['invalidateCacheTags']>,
default: () => [],
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/vue3/src/link.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const Link: InertiaLink = defineComponent({
default: noop,
},
cacheTags: {
type: Array as PropType<string[]>,
type: [String, Array] as PropType<string | string[]>,
default: () => [],
},
},
Expand Down