Skip to content

Commit 415e8bc

Browse files
committed
fix: remove base from plugin if it already exists
Remove the base from the plugin if it already exists in order to avoid duplication. Adding it will apply as normal, which is used in place of updating the values.
1 parent 408c35c commit 415e8bc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/listeners/bases.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export async function getBases(plugin: ThumbnailPlugin): Promise<Array<Base>> {
1818
const files = plugin.app.vault.getFiles().filter((v) => v.extension === "base");
1919
const bases: Array<Base> = [];
2020
for (const file of files) {
21+
const base = plugin.bases.find((f) => f.path == file.path);
22+
if (base) {
23+
plugin.bases.remove(base);
24+
}
2125
bases.push({
2226
path: file.path,
2327
file: file,

0 commit comments

Comments
 (0)