File tree 3 files changed +12
-3
lines changed
3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,21 @@ import {
5
5
IGatsbyCompleteJobV2 ,
6
6
} from "../types"
7
7
8
- export const jobsV2Reducer = (
9
- state : IGatsbyState [ "jobsV2" ] = {
8
+ const initialState = ( ) : IGatsbyState [ "jobsV2" ] => {
9
+ return {
10
10
incomplete : new Map ( ) ,
11
11
complete : new Map ( ) ,
12
- } ,
12
+ }
13
+ }
14
+
15
+ export const jobsV2Reducer = (
16
+ state = initialState ( ) ,
13
17
action : ActionsUnion
14
18
) : IGatsbyState [ "jobsV2" ] => {
15
19
switch ( action . type ) {
20
+ case `DELETE_CACHE` :
21
+ return action . cacheIsCorrupt ? initialState ( ) : state
22
+
16
23
case `CREATE_JOB_V2` : {
17
24
const { job, plugin } = action . payload
18
25
Original file line number Diff line number Diff line change @@ -574,6 +574,7 @@ export interface ISetResolvedThemesAction {
574
574
575
575
export interface IDeleteCacheAction {
576
576
type : `DELETE_CACHE`
577
+ cacheIsCorrupt ?: boolean
577
578
}
578
579
579
580
export interface IRemovePageDataAction {
Original file line number Diff line number Diff line change @@ -278,6 +278,7 @@ export async function initialize({
278
278
// been loaded from the file system cache).
279
279
store . dispatch ( {
280
280
type : `DELETE_CACHE` ,
281
+ cacheIsCorrupt,
281
282
} )
282
283
283
284
// in future this should show which plugin's caches are purged
You can’t perform that action at this time.
0 commit comments