Make backpack web source adding idempotent

This commit is contained in:
Paul Kaplan committed 2018-06-19 12:07:37 -04:00
1 parent bbf0ba4e25
commit 99afc4bef3
1 file changed
+3 -1
+3 -1
View File
@@ -23,11 +23,13 @@ class Backpack extends React.Component {
};
// If a host is given, add it as a web source to the storage module
if (props.host) {
// TODO remove the hacky flag that prevents double adding
if (props.host && !storage._hasAddedBackpackSource) {
storage.addWebSource(
[storage.AssetType.ImageVector, storage.AssetType.ImageBitmap, storage.AssetType.Sound],
asset => `${props.host}/${asset.assetId}.${asset.dataFormat}`
);
storage._hasAddedBackpackSource = true;
}
}
handleToggle () {