File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -92,19 +92,27 @@ public BitmapImage CustomIcon
92
92
93
93
public ulong ? FileFRN { get ; set ; }
94
94
95
- private string [ ] fileTags ; // TODO: initialize to empty array after UI is done
95
+ private string [ ] fileTags = null ! ;
96
96
public string [ ] FileTags
97
97
{
98
98
get => fileTags ;
99
99
set
100
100
{
101
+ // fileTags is null when the item is first created
102
+ var fileTagsInitialized = fileTags is not null ;
101
103
if ( SetProperty ( ref fileTags , value ) )
102
104
{
103
105
Debug . Assert ( value != null ) ;
104
- var dbInstance = FileTagsHelper . GetDbInstance ( ) ;
105
- dbInstance . SetTags ( ItemPath , FileFRN , value ) ;
106
+
107
+ // only set the tags if the file tags have been changed
108
+ if ( fileTagsInitialized )
109
+ {
110
+ var dbInstance = FileTagsHelper . GetDbInstance ( ) ;
111
+ dbInstance . SetTags ( ItemPath , FileFRN , value ) ;
112
+ FileTagsHelper . WriteFileTag ( ItemPath , value ) ;
113
+ }
114
+
106
115
HasTags = ! FileTags . IsEmpty ( ) ;
107
- FileTagsHelper . WriteFileTag ( ItemPath , value ) ;
108
116
OnPropertyChanged ( nameof ( FileTagsUI ) ) ;
109
117
}
110
118
}
You can’t perform that action at this time.
0 commit comments