{"record":{"id":"88f32939689854b2","repo":"Meituan-Dianping/mpvue","slug":"invalid-default-value-for-prop-key-props-wit","errorCode":null,"errorMessage":"Invalid default value for prop \"${key}\": Props with type Object/Array must use a factory function to return the default value.","messagePattern":"Invalid default value for prop \"(.+?)\": Props with type Object/Array must use a factory function to return the default value\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/util/props.js","lineNumber":64,"sourceCode":"  }\n  if (process.env.NODE_ENV !== 'production') {\n    assertProp(prop, key, value, vm, absent)\n  }\n  return value\n}\n\n/**\n * Get the default value of a prop.\n */\nfunction getPropDefaultValue (vm: ?Component, prop: PropOptions, key: string): any {\n  // no default, return undefined\n  if (!hasOwn(prop, 'default')) {\n    return undefined\n  }\n  const def = prop.default\n  // warn against non-factory defaults for Object & Array\n  if (process.env.NODE_ENV !== 'production' && isObject(def)) {\n    warn(\n      'Invalid default value for prop \"' + key + '\": ' +\n      'Props with type Object/Array must use a factory function ' +\n      'to return the default value.',\n      vm\n    )\n  }\n  // the raw prop value was also undefined from previous render,\n  // return previous default value to avoid unnecessary watcher trigger\n  if (vm && vm.$options.propsData &&\n    vm.$options.propsData[key] === undefined &&\n    vm._props[key] !== undefined\n  ) {\n    return vm._props[key]\n  }\n  // call factory function for non-Function types\n  // a value is Function if its prototype is function even across different execution context\n  return typeof def === 'function' && getType(prop.type) !== 'Function'\n    ? def.call(vm)","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/Meituan-Dianping/mpvue/blob/6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b/src/core/util/props.js#L46-L82","documentation":"Raised in getPropDefaultValue during prop validation when the prop declares a 'default' whose value isObject(def) — i.e. a plain object or array literal. Object/Array defaults are shared by reference across all instances of the component, so one instance mutating the default would leak into every other instance; Vue requires a factory function whose fresh return value is used per instance. The object default is still used (called as-is if a function, otherwise passed through), but the shared-reference hazard remains.","triggerScenarios":"Thrown at src/core/util/props.js:64 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a factory function for object/array defaults: props: { items: { type: Array, default: () => [] } } or default() { return { a: 1 } }","Scalar defaults (String, Number, Boolean) may stay as plain values","Audit shared default objects for in-place mutation; move all mutation to per-instance data copies"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c5d78ee04f58c6d782c456dfcf0fe63c0b7f89b","analyzedAt":"2026-09-02T05:17:40.946Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}