File tree 3 files changed +33
-1
lines changed
3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,20 @@ export function queriesReducer(
90
90
state . deletedQueries . add ( action . payload . path )
91
91
return state
92
92
}
93
+ case `DELETED_STALE_PAGE_DATA_FILES` : {
94
+ // this action is a hack/hot fix
95
+ // it should be removed/reverted when we start persisting pages state
96
+ for ( const queryId of action . payload . pagePathsToClear ) {
97
+ for ( const component of state . trackedComponents . values ( ) ) {
98
+ component . pages . delete ( queryId )
99
+ }
100
+ state = clearNodeDependencies ( state , queryId )
101
+ state = clearConnectionDependencies ( state , queryId )
102
+ state . trackedQueries . delete ( queryId )
103
+ }
104
+
105
+ return state
106
+ }
93
107
case `API_FINISHED` : {
94
108
if ( action . payload . apiName !== `createPages` ) {
95
109
return state
Original file line number Diff line number Diff line change @@ -352,6 +352,7 @@ export type ActionsUnion =
352
352
| IDisableTypeInferenceAction
353
353
| ISetProgramAction
354
354
| ISetProgramExtensions
355
+ | IDeletedStalePageDataFiles
355
356
356
357
export interface IApiFinishedAction {
357
358
type : `API_FINISHED`
@@ -804,3 +805,10 @@ interface ISetProgramExtensions {
804
805
type : `SET_PROGRAM_EXTENSIONS`
805
806
payload : Array < string >
806
807
}
808
+
809
+ interface IDeletedStalePageDataFiles {
810
+ type : `DELETED_STALE_PAGE_DATA_FILES`
811
+ payload : {
812
+ pagePathsToClear : Set < string >
813
+ }
814
+ }
Original file line number Diff line number Diff line change @@ -256,10 +256,20 @@ export async function handleStalePageData(): Promise<void> {
256
256
} )
257
257
258
258
const deletionPromises : Array < Promise < void > > = [ ]
259
- pageDataFilesFromPreviousBuilds . forEach ( pageDataFilePath => {
259
+ const pagePathsToClear = new Set < string > ( )
260
+ for ( const pageDataFilePath of pageDataFilesFromPreviousBuilds ) {
260
261
if ( ! expectedPageDataFiles . has ( pageDataFilePath ) ) {
262
+ const stalePageDataContent = await fs . readJson ( pageDataFilePath )
263
+ pagePathsToClear . add ( stalePageDataContent . path )
261
264
deletionPromises . push ( fs . remove ( pageDataFilePath ) )
262
265
}
266
+ }
267
+
268
+ store . dispatch ( {
269
+ type : `DELETED_STALE_PAGE_DATA_FILES` ,
270
+ payload : {
271
+ pagePathsToClear,
272
+ } ,
263
273
} )
264
274
265
275
await Promise . all ( deletionPromises )
You can’t perform that action at this time.
0 commit comments