File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -53,16 +53,19 @@ pub fn save_edit(params: SaveEdit) {
53
53
config,
54
54
} = params;
55
55
56
- config. db . write ( ) . unwrap ( ) . edit_field ( id, & field, value. get ( ) ) ;
57
- if field == DbFields :: Title {
58
- let new_list = config. db . read ( ) . unwrap ( ) . get_list ( ) ;
59
- set_list. update ( |list : & mut im:: Vector < ( usize , & ' static str , usize ) > | {
60
- * list = new_list;
61
- } ) ;
62
- }
56
+ let last_val = config. db . read ( ) . unwrap ( ) . get_last_by_field ( & id, & field) ;
57
+ if last_val != value. get ( ) {
58
+ config. db . write ( ) . unwrap ( ) . edit_field ( id, & field, value. get ( ) ) ;
59
+ if field == DbFields :: Title {
60
+ let new_list = config. db . read ( ) . unwrap ( ) . get_list ( ) ;
61
+ set_list. update ( |list : & mut im:: Vector < ( usize , & ' static str , usize ) > | {
62
+ * list = new_list;
63
+ } ) ;
64
+ }
63
65
64
- dates. set ( config. db . read ( ) . unwrap ( ) . get_history_dates ( & id, & field) ) ;
65
- input_id. request_focus ( ) ;
66
+ dates. set ( config. db . read ( ) . unwrap ( ) . get_history_dates ( & id, & field) ) ;
67
+ input_id. request_focus ( ) ;
68
+ }
66
69
67
70
if is_secret {
68
71
value. set ( String :: from ( SECRET_PLACEHOLDER ) ) ;
Original file line number Diff line number Diff line change @@ -181,8 +181,6 @@ pub fn list_item(param: ListItem) -> impl View {
181
181
tooltip_signals,
182
182
} ,
183
183
move |_| {
184
- // TODO: compare to reset_text and don't save if the same
185
-
186
184
if save_btn_visible. get ( ) {
187
185
reset_text. set ( field_value. get ( ) ) ;
188
186
if is_secret {
You can’t perform that action at this time.
0 commit comments