@@ -458,11 +458,29 @@ export class Plugin extends PluginBase<PluginTypes> {
458458 const cache = await getCacheSafe ( this . app , note ) ;
459459 if ( cache ) {
460460 cache . frontmatterLinks ??= [ ] ;
461+ const currentLinks = new Map < string , FrontmatterLinkCache > ( ) ;
462+
463+ for ( const link of cache . frontmatterLinks ) {
464+ currentLinks . set ( link . key , link ) ;
465+ }
466+
461467 const linkKeys = new Set ( links . map ( ( link ) => link . key ) ) ;
462468 filterInPlace ( cache . frontmatterLinks , ( link ) => ! linkKeys . has ( link . key ) ) ;
463- cache . frontmatterLinks . push ( ...links ) ;
469+
470+ const newLinks : FrontmatterLinkCache [ ] = [ ] ;
464471
465472 for ( const link of links ) {
473+ const currentLink = currentLinks . get ( link . key ) ;
474+ if ( currentLink && currentLink . original !== link . original ) {
475+ cache . frontmatterLinks . push ( currentLink ) ;
476+ continue ;
477+ }
478+
479+ cache . frontmatterLinks . push ( link ) ;
480+ newLinks . push ( link ) ;
481+ }
482+
483+ for ( const link of newLinks ) {
466484 this . updateResolvedOrUnresolvedLinksCache ( link . link , note . path ) ;
467485 }
468486 }
@@ -488,6 +506,7 @@ export class Plugin extends PluginBase<PluginTypes> {
488506
489507 private processFrontmatterLinks ( value : unknown , key : string , cache : CachedMetadata , filePath : string ) : boolean {
490508 if ( typeof value === 'string' ) {
509+ this . frontmatterMarkdownLinksCache . deleteKey ( filePath , key ) ;
491510 const parseLinkResults = parseLinks ( value ) ;
492511 const isSingleLink = parseLinkResults [ 0 ] ?. raw === value ;
493512
0 commit comments