Skip to content

Commit de7781c

Browse files
committed
fix: remove non-existing cache entries
1 parent c982dea commit de7781c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Plugin.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ import {
3434
invokeAsyncSafely,
3535
requestAnimationFrameAsync
3636
} from 'obsidian-dev-utils/Async';
37-
import { getPrototypeOf } from 'obsidian-dev-utils/ObjectUtils';
37+
import {
38+
getNestedPropertyValue,
39+
getPrototypeOf
40+
} from 'obsidian-dev-utils/ObjectUtils';
3841
import {
3942
parseLink,
4043
parseLinks,
@@ -477,8 +480,12 @@ export class Plugin extends PluginBase<PluginTypes> {
477480
continue;
478481
}
479482

480-
cache.frontmatterLinks.push(link);
481-
newLinks.push(link);
483+
if (cache.frontmatter && getNestedPropertyValue(cache.frontmatter, link.key) instanceof String) {
484+
cache.frontmatterLinks.push(link);
485+
newLinks.push(link);
486+
} else {
487+
this.frontmatterMarkdownLinksCache.deleteKey(note.path, link.key);
488+
}
482489
}
483490

484491
for (const link of newLinks) {

0 commit comments

Comments
 (0)