Skip to content

Commit

Permalink
Clean up fastAddProperties and make it more correct
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytrorykun committed May 7, 2024
1 parent 7039834 commit 81c12a2
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,27 +462,27 @@ function fastAddProperties(

attributeConfig = validAttributes[propKey];

if (attributeConfig === undefined) {
if (!attributeConfig) {
continue;
}

if (typeof nextProp === 'function') {
nextProp = (true: any);
}
let newValue;

if (typeof attributeConfig !== 'object') {
if (!updatePayload) {
updatePayload = ({}: {[string]: $FlowFixMe});
}
updatePayload[propKey] = nextProp;
continue;
if (typeof nextProp === 'function') {
newValue = (true: any);
} else if (typeof attributeConfig !== 'object') {
newValue = nextProp;
} else if (typeof attributeConfig.process === 'function') {
newValue = attributeConfig.process(nextProp);
} else if (typeof attributeConfig.diff === 'function') {
newValue = nextProp;
}

if (typeof attributeConfig.process === 'function') {
if (newValue !== undefined) {
if (!updatePayload) {
updatePayload = ({}: {[string]: $FlowFixMe});
}
updatePayload[propKey] = attributeConfig.process(nextProp);
updatePayload[propKey] = newValue;
continue;
}

Expand Down

0 comments on commit 81c12a2

Please sign in to comment.