Skip to content

Commit

Permalink
Fix reloads of same xml for temporary assets (#7761)
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll authored Jan 11, 2021
1 parent 54a8ad6 commit 72e5aa5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pxtblocks/fields/field_asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,12 @@ namespace pxtblockly {
const project = pxt.react.getTilemapProject();

const id = this.getBlockData();
if (id) {
this.asset = project.lookupAsset(this.getAssetType(), id);
const existing = project.lookupAsset(this.getAssetType(), id);
if (existing) {
this.asset = existing;
}
else {
this.setBlockData(null);
if (this.asset) {
if (this.sourceBlock_ && this.asset.meta.blockIDs) {
this.asset.meta.blockIDs = this.asset.meta.blockIDs.filter(id => id !== this.sourceBlock_.id);
Expand Down

0 comments on commit 72e5aa5

Please sign in to comment.