Fix regression where the index would no longer be cleared in sync mode
parent
0e2553839c
commit
78be20c24f
|
@ -117,6 +117,7 @@ export class EventedSpacePrimitives implements SpacePrimitives {
|
|||
async writeFile(
|
||||
name: string,
|
||||
data: Uint8Array,
|
||||
// TODO: Is self update still used or can it now be removed?
|
||||
selfUpdate?: boolean,
|
||||
meta?: FileMeta,
|
||||
): Promise<FileMeta> {
|
||||
|
@ -128,15 +129,13 @@ export class EventedSpacePrimitives implements SpacePrimitives {
|
|||
selfUpdate,
|
||||
meta,
|
||||
);
|
||||
if (!selfUpdate) {
|
||||
await this.dispatchEvent(
|
||||
"file:changed",
|
||||
name,
|
||||
true,
|
||||
undefined,
|
||||
newMeta.lastModified,
|
||||
);
|
||||
}
|
||||
await this.dispatchEvent(
|
||||
"file:changed",
|
||||
name,
|
||||
true,
|
||||
undefined,
|
||||
newMeta.lastModified,
|
||||
);
|
||||
this.spaceSnapshot[name] = newMeta.lastModified;
|
||||
|
||||
if (name.endsWith(".md")) {
|
||||
|
|
|
@ -599,12 +599,13 @@ export class Client {
|
|||
"file:changed",
|
||||
(
|
||||
path: string,
|
||||
_localChange: boolean,
|
||||
localChange: boolean,
|
||||
oldHash: number,
|
||||
newHash: number,
|
||||
) => {
|
||||
// Only reload when watching the current page (to avoid reloading when switching pages)
|
||||
if (
|
||||
!localChange &&
|
||||
this.space.watchInterval && `${this.currentPage}.md` === path &&
|
||||
// Avoid reloading if the page was just saved (5s window)
|
||||
(!lastSaveTimestamp || (lastSaveTimestamp < Date.now() - 5000))
|
||||
|
|
Loading…
Reference in New Issue