Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breadcrumbs after update #494

Merged
merged 8 commits into from
Sep 28, 2023
9 changes: 8 additions & 1 deletion packages/core/src/Source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export default class Source {
* Called when another source (not this one) has changed.
* This source can then ask its plugins if they also want to clear their cache in response to the other source's change.
*/
async requestCacheClear(updatedSourceFilesystem: IVolumeImmutable) {
async requestCacheClear(
updatedSourceFilesystem: IVolumeImmutable,
sharedFilesystem: IVolumeImmutable,
globalConfig: MutableData<unknown>
) {
const initTime = new Date().getTime();
const shouldInvokeAfterUpdate = await this.#pluginApi.shouldClearCache(
updatedSourceFilesystem,
Expand All @@ -130,6 +134,9 @@ export default class Source {
}
if (shouldInvokeAfterUpdate === true) {
this.filesystem.clearCache();
this.filesystem.unfreeze();
await this.invokeAfterUpdate(sharedFilesystem, globalConfig);
DavieReid marked this conversation as resolved.
Show resolved Hide resolved
this.filesystem.freeze();
}
}

Expand Down
7 changes: 5 additions & 2 deletions packages/core/src/SourceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ export default class SourceManager {
if (!sourceActive) {
return;
}

await source.invokeAfterUpdate(this.#sharedFilesystem, this.#globalConfig);

// After each async operation, we should check if anything has caused the Source to close
Expand Down Expand Up @@ -217,7 +216,11 @@ export default class SourceManager {
return Promise.all(
Array.from(this.#sources.values()).map(existingSource => {
if (existingSource !== source && existingSource.filesystem.frozen) {
return existingSource.requestCacheClear(immutableSourceFilesystem);
return existingSource.requestCacheClear(
immutableSourceFilesystem,
this.#sharedFilesystem,
this.#globalConfig
);
}
return existingSource;
})
Expand Down