Skip to content

Commit

Permalink
use null value
Browse files Browse the repository at this point in the history
  • Loading branch information
0x8890 committed Sep 22, 2015
1 parent 33f146d commit 4883cb9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/dispatch/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default function (context) {
return Promise.all(Object.keys(updates)
.map(type => updates[type].length ?
transaction.update(type, updates[type], meta) :
Promise.resolve()))
null))
})

.then(() => transaction.endTransaction())
Expand Down
13 changes: 8 additions & 5 deletions lib/dispatch/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default function (context) {
return Promise.all(Object.keys(updates)
.map(type => updates[type].length ?
transaction.update(type, updates[type], meta) :
Promise.resolve([])))
null))
})

.then(() => transaction.endTransaction())
Expand All @@ -105,10 +105,13 @@ export default function (context) {
[deleteMethod]: { [type]: ids }
}

for (let type of Object.keys(updates)) {
if (!updates[type].length) continue
if (!(updateMethod in eventData)) eventData[updateMethod] = {}
eventData[updateMethod][type] = updates[type].map(mapId)
if (Object.keys(updates).length) {
eventData[updateMethod] = {}

for (let type in updates) {
if (!updates[type].length) continue
eventData[updateMethod][type] = updates[type].map(mapId)
}
}

// Summarize changes during the lifecycle of the request.
Expand Down
2 changes: 1 addition & 1 deletion lib/dispatch/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export default function (context) {
return Promise.all(Object.keys(relatedUpdates)
.map(type => relatedUpdates[type].length ?
transaction.update(type, relatedUpdates[type], meta) :
Promise.resolve()))
null))
})

.then(() => transaction.endTransaction())
Expand Down

0 comments on commit 4883cb9

Please sign in to comment.