chore(extension): show error when connection is rejected due to inact… (#836)
…ivity
This commit is contained in:
@@ -166,8 +166,10 @@ class TabShareExtension {
|
|||||||
if (!pending.timerId) {
|
if (!pending.timerId) {
|
||||||
pending.timerId = setTimeout(() => {
|
pending.timerId = setTimeout(() => {
|
||||||
const existed = this._pendingTabSelection.delete(tabId);
|
const existed = this._pendingTabSelection.delete(tabId);
|
||||||
if (existed)
|
if (existed) {
|
||||||
pending.connection.close('Tab has been inactive for 5 seconds');
|
pending.connection.close('Tab has been inactive for 5 seconds');
|
||||||
|
chrome.tabs.sendMessage(tabId, { type: 'connectionTimeout' });
|
||||||
|
}
|
||||||
}, 5000);
|
}, 5000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,13 @@ const ConnectApp: React.FC = () => {
|
|||||||
setStatus({ type: 'error', message: 'Connection rejected. This tab can be closed.' });
|
setStatus({ type: 'error', message: 'Connection rejected. This tab can be closed.' });
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
chrome.runtime.onMessage.addListener(message => {
|
||||||
|
if (message.type === 'connectionTimeout')
|
||||||
|
handleReject();
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='app-container'>
|
<div className='app-container'>
|
||||||
<div className='content-wrapper'>
|
<div className='content-wrapper'>
|
||||||
|
|||||||
Reference in New Issue
Block a user