Skip to content

Commit 1e046ce

Browse files
committed
Clear persisted value when default value is used
Otherwise, the last-used non-default value remains persisted for next time. This results in surprising behavior where setting a field back to the default works, but then does not persist the next time you run. This commit is dedicated to Klim Kolyvanov.
1 parent c05a172 commit 1e046ce

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/main/java/org/scijava/module/DefaultModuleService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ public <T> void save(final ModuleItem<T> item, final T value) {
294294
// NB: Do not persist the value if it is the default.
295295
// This is nice if the default value might change later,
296296
// such as when iteratively developing a script.
297+
prefService.remove(prefClass(item), prefKey(item));
297298
return;
298299
}
299300

0 commit comments

Comments
 (0)