mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
more elegant code
This commit is contained in:
parent
3edbd2c97a
commit
aabd1baf93
1 changed files with 3 additions and 6 deletions
|
@ -102,13 +102,10 @@ const getInitialStateFromProps = nextProps => {
|
|||
Object.keys(convertedSchema).forEach(key => {
|
||||
let minCount = convertedSchema[key].minCount;
|
||||
if(minCount) {
|
||||
if(!initialDocument[key])
|
||||
initialDocument[key] = [];
|
||||
let toAdd = minCount - initialDocument[key].length;
|
||||
for( let i = 0; i < toAdd; i++ ) {
|
||||
initialDocument[key] = initialDocument[key] || [];
|
||||
while(initialDocument[key].length < minCount)
|
||||
initialDocument[key].push({});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// remove all instances of the `__typename` property from document
|
||||
|
|
Loading…
Add table
Reference in a new issue