Closed mattjennings closed 5 months ago
I suspect there may be another scenario where this connection gets lost without ever switching tabs from doing many page reloads (e.g. hot reloads from dev server), but I could not repro that as easily. For now, this connection check happens on page focus, but perhaps it's worth checking on an interval as well. I also don't know if there are any ramifications for calling chrome.runtime.connect()
multiple times per lifecycle but it didn't seem to be an issue...
See discord thread for detailed findings.
The best way I was able to reproduce this issue was by:
this caused both my tab & the service worker to reload, however the dev tools panel remained open and so it lost the connection to the service worker. I couldn't find any way to find out when this connection was lost (no disconnect events or anything were fired), other than attempting a
chrome.runtime.connect()
again and catching the specific error.If the error is caught, it simply does a
window.location.reload
to reload the panel (chrome.runtime.reload()
did not work)