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:
parent
466872affb
commit
ea18b31db1
@ -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.');
|
||||||
|
Loading…
Reference in New Issue
Block a user