Clear runtime after validation success instead of before.

This commit is contained in:
Karishma Chadha 2018-03-21 17:46:39 -04:00
parent ab863096cd
commit ce6ef92eb5

View file

@ -187,9 +187,6 @@ class VirtualMachine extends EventEmitter {
input = JSON.stringify(input); input = JSON.stringify(input);
} }
// Clear the current runtime
this.clear();
const validationPromise = new Promise((resolve, reject) => { const validationPromise = new Promise((resolve, reject) => {
validate(input, (error, res) => { validate(input, (error, res) => {
if (error) { if (error) {
@ -282,6 +279,9 @@ class VirtualMachine extends EventEmitter {
* @returns {Promise} Promise that resolves after the project has loaded * @returns {Promise} Promise that resolves after the project has loaded
*/ */
deserializeProject (projectJSON, zip) { deserializeProject (projectJSON, zip) {
// Clear the current runtime
this.clear();
const runtime = this.runtime; const runtime = this.runtime;
const deserializePromise = function () { const deserializePromise = function () {
const projectVersion = projectJSON.projectVersion; const projectVersion = projectJSON.projectVersion;