diff --git a/src/runtime/internal/Component.ts b/src/runtime/internal/Component.ts index d0b4a3aef2..46fa6756ca 100644 --- a/src/runtime/internal/Component.ts +++ b/src/runtime/internal/Component.ts @@ -129,27 +129,19 @@ export function init(component, options, instance, create_fragment, not_equal, p $$.ctx = instance ? instance(component, prop_values, (args) => { let { i, ret, value } = args; - const isValuePassed = !!Object.keys(args).find(e => e === 'value'); - const assign = () => { + if ($$.ctx) { + const isValuePassed = !!Object.keys(args).find(e => e === 'value'); + + value = isValuePassed ? value : (value || ret); + if (not_equal($$.ctx[i], ($$.ctx[i] = value))) { if ($$.bound[i]) $$.bound[i](value); if (ready) make_dirty(component, i); } - }; - - if ($$.ctx) { - if (!isValuePassed && typeof $$.ctx[i] === 'undefined') { - assign(); - return ret; - } - - value = isValuePassed ? value : (value || ret); - assign(); } return ret; - }) : [];