1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 18:35:09 +01:00

Small style changes for Piece and Edition ListStores

This commit is contained in:
Brett Sun 2016-01-13 17:14:09 +01:00
parent 466872affb
commit ea18b31db1
2 changed files with 14 additions and 15 deletions

View File

@ -60,7 +60,7 @@ class PieceListStore {
* point anyway. Then, this problem is automatically resolved. * point anyway. Then, this problem is automatically resolved.
*/ */
pieceList.forEach((piece, i) => { pieceList.forEach((piece, i) => {
let oldPiece = this.pieceList[i]; const oldPiece = this.pieceList[i];
if (oldPiece) { if (oldPiece) {
piece = React.addons.update(piece, { piece = React.addons.update(piece, {
show: { $set: oldPiece.show } show: { $set: oldPiece.show }
@ -77,11 +77,10 @@ class PieceListStore {
} }
onUpdatePropertyForPiece({ pieceId, key, value }) { onUpdatePropertyForPiece({ pieceId, key, value }) {
let filteredPieceList = this.pieceList.filter((piece) => piece.id === pieceId); const filteredPieceList = this.pieceList.filter((piece) => piece.id === pieceId);
if (filteredPieceList.length === 1) { if (filteredPieceList.length === 1) {
const piece = filteredPieceList[0];
let piece = filteredPieceList[0];
piece[key] = value; piece[key] = value;
} else { } else {
throw new Error('Could not find a matching piece in piece list since its either not there or piecelist contains duplicates.'); throw new Error('Could not find a matching piece in piece list since its either not there or piecelist contains duplicates.');