diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 60978eea3..a1533b67f 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -668,13 +668,6 @@ const sb2import = function (json, runtime, optForceSprite, zip) { }; return parseScratchObject(json, runtime, extensions, !optForceSprite, zip) - .then(targets => { - if (optForceSprite && targets.length === 1) { - const target = targets[0]; - target.fixUpVariableReferences(); - } - return targets; - }) .then(targets => ({ targets, extensions diff --git a/src/serialization/sb3.js b/src/serialization/sb3.js index fb4cbeffd..0ecff4ed5 100644 --- a/src/serialization/sb3.js +++ b/src/serialization/sb3.js @@ -937,13 +937,6 @@ const deserialize = function (json, runtime, zip, isSingleSprite) { ((isSingleSprite ? [json] : json.targets) || []).map(target => parseScratchObject(target, runtime, extensions, zip)) ) - .then(targets => { - if (isSingleSprite && targets.length === 1) { - const target = targets[0]; - target.fixUpVariableReferences(); - } - return targets; - }) .then(targets => ({ targets, extensions diff --git a/src/virtual-machine.js b/src/virtual-machine.js index 378f9021a..b0571e52c 100644 --- a/src/virtual-machine.js +++ b/src/virtual-machine.js @@ -386,6 +386,10 @@ class VirtualMachine extends EventEmitter { this.editingTarget = targets[0]; } + if (!wholeProject) { + this.editingTarget.fixUpVariableReferences(); + } + // Update the VM user's knowledge of targets and blocks on the workspace. this.emitTargetsUpdate(); this.emitWorkspaceUpdate();