Skip to content

Commit

Permalink
Merge b34efaa into e1adcc8
Browse files Browse the repository at this point in the history
  • Loading branch information
acdha committed Sep 24, 2019
2 parents e1adcc8 + b34efaa commit 29a2f68
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion concordia/static/js/action-app/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
setChildren,
setAttr,
List
} from 'https://cdnjs.cloudflare.com/ajax/libs/redom/3.18.0/redom.es.min.js';
} from 'https://cdnjs.cloudflare.com/ajax/libs/redom/3.24.1/redom.es.min.js';

export function conditionalUnmount(component) {
if (component.el.parentNode) {
Expand Down
28 changes: 21 additions & 7 deletions concordia/static/js/action-app/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global Split jQuery URITemplate sortBy Sentry */
/* eslint-disable no-console */

import {mount} from 'https://cdnjs.cloudflare.com/ajax/libs/redom/3.18.0/redom.es.min.js';
import {mount} from 'https://cdnjs.cloudflare.com/ajax/libs/redom/3.24.1/redom.es.min.js';
import {
Alert,
AssetList,
Expand Down Expand Up @@ -364,11 +364,17 @@ export class ActionApp {
this.updateViewer();
}

let assetListItem = this.assetList.lookup[assetId];
if (assetListItem) {
// If this is visible, we want to update the displayed asset
// list icon using the current value:
assetListItem.update(this.getAssetData(assetId));
if (typeof this.assetList.lookup == 'undefined') {
console.warn(
`Expected this.assetList to be an initialized List but found ${this.assetList}`
);
} else {
let assetListItem = this.assetList.lookup[assetId];
if (assetListItem) {
// If this is visible, we want to update the displayed asset
// list icon using the current value:
assetListItem.update(this.getAssetData(assetId));
}
}
});

Expand Down Expand Up @@ -617,6 +623,10 @@ export class ActionApp {
of the fields which frequently change.
*/

if (typeof assetId != 'number') {
assetId = Number(assetId);
}

let oldData = this.getAssetData(assetId) || {};
let mergedData = Object.assign({}, oldData);
mergedData = Object.assign(mergedData, newData);
Expand All @@ -639,6 +649,10 @@ export class ActionApp {
}
}

if (!('id' in mergedData)) {
mergedData.id = assetId;
}

mergedData.editable = this.canEditAsset(mergedData);

this.assets.set(assetId, mergedData);
Expand Down Expand Up @@ -671,7 +685,7 @@ export class ActionApp {
assetID = asset.id;
}

if (!asset) {
if (!asset || !assetID) {
throw `No information for an asset with ID ${assetID}`;
}

Expand Down

0 comments on commit 29a2f68

Please sign in to comment.