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