🐛 (backlinks) update to override backlink in db
This commit is contained in:
@@ -8,6 +8,7 @@ import { resolvePath } from '@/modules/repo/services/resolvePath'
|
||||
import { useUserRepoStore } from '@/modules/repo/store/userRepo.store'
|
||||
import { isExternalLink } from '@/utils/link'
|
||||
import { filenameToNoteTitle } from '@/utils/noteTitle'
|
||||
import { confirmMessage } from '@/utils/notif'
|
||||
import { watch } from 'vue'
|
||||
|
||||
const isMarkdown = (filename?: string) => filename?.endsWith('.md') ?? false
|
||||
@@ -20,6 +21,8 @@ export const useComputeBacklinks = () => {
|
||||
return
|
||||
}
|
||||
|
||||
let notifiedForComputation = false
|
||||
|
||||
const backlinks: Map<string, Backlink[]> = new Map()
|
||||
|
||||
for (const file of store.files) {
|
||||
@@ -65,6 +68,11 @@ export const useComputeBacklinks = () => {
|
||||
continue
|
||||
}
|
||||
|
||||
if (!notifiedForComputation) {
|
||||
notifiedForComputation = true
|
||||
confirmMessage('Updating backlinks...')
|
||||
}
|
||||
|
||||
backlinks.set(backlinkFile.sha, [
|
||||
...previousBacklinks,
|
||||
{
|
||||
@@ -84,7 +92,7 @@ export const useComputeBacklinks = () => {
|
||||
links: fileBacklinks
|
||||
}
|
||||
|
||||
await data.add(backlinkNote)
|
||||
await data.update(backlinkNote)
|
||||
backlinkEventBus.emit({ fileSha: sha })
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user