-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix live preview reload for documentSaved events #5207
Conversation
agents.network && agents.network.wasURLRequested(doc.url)) { | ||
var absolutePath = Inspector.connected() && doc.file.fullPath, | ||
liveDocument = _server && absolutePath && _server.get(absolutePath), | ||
instrumentationEnabled = liveDocument && liveDocument.isInstrumentationEnabled && liveDocument.isInstrumentationEnabled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming nit: the term "instrumentationEnabled" doesn't really match the functionality. HTML documents are instrumented, but CSS documents aren't. How about using liveEditingEnabled
instead? The function on CSSDocument/HTMLDocument would be called isLiveEditingEnabled()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
I'm seeing a failure in the Live Development unit tests: "should reapply in-memory css changes after saving changes in html document". |
Initial review complete. |
@@ -104,7 +121,7 @@ define(function (require, exports, module) { | |||
|
|||
var liveDoc; | |||
waitsFor(function () { | |||
liveDoc = LiveDevelopment.getLiveDocForPath(testPath + "/" + cssFile); | |||
liveDoc = LiveDevelopment.getLiveDocForPath(SpecRunnerUtils.getTempDirectory() + "/" + cssFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SpecRunnerUtils.getTempDirectory()
is used several times in this file. This value should be in a variable.
@jasonsanjose re-review complete. Still have one failing unit test. |
…_SAVE test cases.
@gruehle went a different route to fix the async bug in that test. Changed the tests to wait for the |
@@ -688,13 +729,6 @@ define(function (require, exports, module) { | |||
// Verify that we still have modified text | |||
expect(updatedNode.value).toBe("Live Preview in Brackets is awesome!"); | |||
}); | |||
|
|||
// Save original content back to the file after this test passes/fails |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to restore file content now that we read the project from test/temp
Everything is working well. It's too bad we need to wait 3 seconds for each of the tests that is expecting the page to not reload, but I can't think of an alternative. Merging. |
Fix live preview reload for documentSaved events
Fix for #5185. Instead of relying on
doc.url
, simply use theDocument.file.fullPath
and let the server provide the expected URL.