1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-18 17:02:27 +02:00

Fix management of reload button in popup panel

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/1461
This commit is contained in:
Raymond Hill 2021-05-15 10:45:31 -04:00
parent 4d29a4c5d2
commit a24e2a5d6c
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1032,8 +1032,8 @@ const reloadTab = function(ev) {
// if there were changes or not. // if there were changes or not.
popupData.contentLastModified = -1; popupData.contentLastModified = -1;
// No need to wait to remove this. // Reset popup state hash to current state.
document.body.classList.remove('needReload'); hashFromPopupData(true);
}; };
uDom('#refresh').on('click', reloadTab); uDom('#refresh').on('click', reloadTab);
@ -1277,7 +1277,7 @@ const pollForContentChange = (( ) => {
/******************************************************************************/ /******************************************************************************/
const getPopupData = async function(tabId) { const getPopupData = async function(tabId, first = false) {
const response = await messaging.send('popupPanel', { const response = await messaging.send('popupPanel', {
what: 'getPopupData', what: 'getPopupData',
tabId, tabId,
@ -1287,7 +1287,7 @@ const getPopupData = async function(tabId) {
renderOnce(); renderOnce();
renderPopup(); renderPopup();
renderPopupLazy(); // low priority rendering renderPopupLazy(); // low priority rendering
hashFromPopupData(true); hashFromPopupData(first);
pollForContentChange(); pollForContentChange();
}; };
@ -1355,7 +1355,7 @@ const getPopupData = async function(tabId) {
document.body.classList.remove('loading'); document.body.classList.remove('loading');
}; };
getPopupData(tabId).then(( ) => { getPopupData(tabId, true).then(( ) => {
if ( document.readyState !== 'complete' ) { if ( document.readyState !== 'complete' ) {
self.addEventListener('load', ( ) => { checkViewport(); }, { once: true }); self.addEventListener('load', ( ) => { checkViewport(); }, { once: true });
} else { } else {