-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix #10821. Allow page reloads, navigating away and back etc. #10822
Fix #10821. Allow page reloads, navigating away and back etc. #10822
Conversation
Also, show the malformed message when such message comes in. Removed the TODO comment wrt sending back the error message: it is unclear what should be done if a malformed message comes in. It is unlikely it will ever happen and even then the error message in the browser should be enough.
It is a simple and robust fix for to address the page reloads, either inflicted by protocol commands or by user-driven page reloads.
Plus this PR has a couple of clean-ups. |
@@ -272,7 +272,6 @@ | |||
}, | |||
|
|||
onClose: function () { | |||
// TODO: This is absolutely temporary solution. |
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.
Just curious, I guess this not an "absolutely temporary solution" after all?
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.
@le717 :) it's been reworked from its original version, but the comment was left. what we have now seems to be satisfactory.
Thanks for putting this up. Hopefully it can be merged soon. I've been hitting this case a lot recently. |
_close(false, "detached_target_closed"); | ||
} | ||
setTimeout(function () { | ||
if (_protocol.getConnectionIds().length === 0) { |
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.
Can't we combine the two conditions to if (_protocol.getConnectionIds().length === 0 && exports.status <= STATUS_ACTIVE)
?
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.
I did it intentionally (for some reason), but you're right, no need.
…allow-reload-in-browser
@marcelgerber, did you try it? it's ready to merged otherwise, it seems. |
…-browser Fix #10821. Allow page reloads, navigating away and back etc.
Merged this. Thank you. |
Fixes multi-browser case only.
Fix #10821: wait for 5 seconds after the last browser has closed connection before shutting down entire LiveDevelopment session.
It's a very simple and robust fix to address page reloads inflicted by
protocol.reload()
or by user-driven page reloads (or navigating back and forth on the page links).A more sophisticated fix would consist of the remote end (a browser) letting know that the page is being unloaded. However, the only case where it would actually help is when the page is reloaded by the protocol command. It still would be impossible to distinguish intentional navigating away from a reload or navigating away by clicking a link on the page being previewed.
CC: @redmunds, @sebaslv