|
|
@ -115,24 +115,27 @@ export function resolveConstructorOptions (Ctor: Class<Component>) { |
|
|
|
function resolveModifiedOptions (Ctor: Class<Component>): ?Object { |
|
|
|
let modified |
|
|
|
const latest = Ctor.options |
|
|
|
const extended = Ctor.extendOptions |
|
|
|
const sealed = Ctor.sealedOptions |
|
|
|
for (const key in latest) { |
|
|
|
if (latest[key] !== sealed[key]) { |
|
|
|
if (!modified) modified = {} |
|
|
|
modified[key] = dedupe(latest[key], sealed[key]) |
|
|
|
modified[key] = dedupe(latest[key], extended[key], sealed[key]) |
|
|
|
} |
|
|
|
} |
|
|
|
return modified |
|
|
|
} |
|
|
|
|
|
|
|
function dedupe (latest, sealed) { |
|
|
|
function dedupe (latest, extended, sealed) { |
|
|
|
// compare latest and sealed to ensure lifecycle hooks won't be duplicated
|
|
|
|
// between merges
|
|
|
|
if (Array.isArray(latest)) { |
|
|
|
const res = [] |
|
|
|
sealed = Array.isArray(sealed) ? sealed : [sealed] |
|
|
|
extended = Array.isArray(extended) ? extended : [extended] |
|
|
|
for (let i = 0; i < latest.length; i++) { |
|
|
|
if (sealed.indexOf(latest[i]) < 0) { |
|
|
|
// push original options and not sealed options to exclude duplicated options
|
|
|
|
if (extended.indexOf(latest[i]) >= 0 || sealed.indexOf(latest[i]) < 0) { |
|
|
|
res.push(latest[i]) |
|
|
|
} |
|
|
|
} |
|
|
|