mirror of
https://github.com/olcubo/obsidian-cubox.git
synced 2026-07-22 05:43:25 +00:00
perf: use getFileCache function to get frontmatter from a file
This commit is contained in:
parent
057d12057d
commit
1ac273ceb7
1 changed files with 5 additions and 5 deletions
10
src/main.ts
10
src/main.ts
|
|
@ -145,11 +145,11 @@ export default class CuboxSyncPlugin extends Plugin {
|
|||
const file = this.app.vault.getAbstractFileByPath(filePath);
|
||||
if (file instanceof TFile) {
|
||||
let foundMatchingId = false
|
||||
await this.app.fileManager.processFrontMatter(file, (frontmatter) => {
|
||||
if (frontmatter.id && frontmatter.id === article.id) {
|
||||
foundMatchingId = true;
|
||||
}
|
||||
});
|
||||
const itemId = this.app.metadataCache.getFileCache(file)?.frontmatter?.id
|
||||
if (itemId && itemId === article.id) {
|
||||
foundMatchingId = true;
|
||||
console.log('found matching id', itemId, article.id);
|
||||
}
|
||||
|
||||
if (foundMatchingId) {
|
||||
skipCount++;
|
||||
|
|
|
|||
Loading…
Reference in a new issue