Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

fix 5110: Switching to other file while Live Development is connecting causes it to fail #5268

Merged
merged 2 commits into from
Sep 24, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/LiveDevelopment/LiveDevelopment.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,12 +974,12 @@ define(function LiveDevelopment(require, exports, module) {

// helper function that actually does the launch once we are sure we have
// a doc and the server for that doc is up and running.
function _doLaunchAfterServerReady() {
function _doLaunchAfterServerReady(doc) {
// update status
_setStatus(STATUS_CONNECTING);

// create live document
_liveDocument = _createDocument(_getCurrentDocument(), EditorManager.getCurrentFullEditor());
_liveDocument = _createDocument(doc, EditorManager.getCurrentFullEditor());

// start listening for requests
_server.add(_liveDocument);
Expand Down Expand Up @@ -1042,7 +1042,10 @@ define(function LiveDevelopment(require, exports, module) {
prepareServerPromise = (doc && _prepareServer(doc)) || new $.Deferred().reject();

// wait for server (StaticServer, Base URL or file:)
prepareServerPromise.done(_doLaunchAfterServerReady);
prepareServerPromise.done(function (result) {
_doLaunchAfterServerReady(doc);
});

prepareServerPromise.fail(function () {
_showWrongDocError();
_openDeferred.reject();
Expand Down