...
 
Commits (1)
  • Tomáš Peterka's avatar
    Gadget state does not get modified by `undefined` · 476ecb77
    Tomáš Peterka authored
    =================================================
    
    Gadget does not take `undefined` arguments as a change to context.
    
    This makes using of default state almost boiler-plate free. Allows to
    easily avoid unnecessary changes by having `undefined` in default state.
    
    For explicite zeroing the state attribute, one should use `null` value.
    476ecb77
......@@ -668,7 +668,8 @@
}
for (key in state_dict) {
if (state_dict.hasOwnProperty(key) &&
(state_dict[key] !== context.state[key])) {
state_dict[key] !== undefined &&
state_dict[key] !== context.state[key]) {
context.state[key] = state_dict[key];
modification_dict[key] = state_dict[key];
modified = true;
......