Merge pull request #102 from manojVivek/feature/reload-ignoring-cache

Fixed #98 - Reload ignoring cache with Cmd/Ctrl + Shift + r
This commit is contained in:
Suresh P 2020-05-24 16:47:22 +05:30 committed by GitHub
commit d895f30a66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 4 deletions

View file

@ -351,8 +351,9 @@ export function triggerNavigationForward() {
};
}
export function triggerNavigationReload() {
export function triggerNavigationReload(_, args) {
return (dispatch: Dispatch, getState: RootStateType) => {
pubsub.publish(NAVIGATION_RELOAD);
const ignoreCache = (args || {}).ignoreCache;
pubsub.publish(NAVIGATION_RELOAD, [{ignoreCache}]);
};
}

View file

@ -200,7 +200,10 @@ class WebView extends Component {
this.webviewRef.current.goForward();
};
processNavigationReloadEvent = () => {
processNavigationReloadEvent = ({ignoreCache}) => {
if (ignoreCache) {
return this.webviewRef.current.reloadIgnoringCache();
}
this.webviewRef.current.reload();
};

View file

@ -157,11 +157,18 @@ export default class MenuBuilder {
submenu: [
{
label: 'Reload',
accelerator: 'Command+R',
accelerator: 'CommandOrControl+R',
click: () => {
this.mainWindow.webContents.reload();
},
},
{
label: 'Reload Ignoring Cache',
accelerator: 'CommandOrControl+Shift+R',
click: () => {
this.mainWindow.webContents.send('reload-url', {ignoreCache: true});
},
},
{
label: 'Toggle Full Screen',
accelerator: 'Ctrl+Command+F',
@ -188,6 +195,13 @@ export default class MenuBuilder {
this.mainWindow.webContents.send('reload-url');
},
},
{
label: 'Reload Ignoring Cache',
accelerator: 'CommandOrControl+Shift+R',
click: () => {
this.mainWindow.webContents.send('reload-url', {ignoreCache: true});
},
},
{
label: 'Toggle Full Screen',
accelerator: 'Ctrl+Command+F',
@ -243,6 +257,15 @@ export default class MenuBuilder {
this.mainWindow.webContents.reload();
},
},
{
label: 'Reload Ignoring Cache',
accelerator: 'CommandOrControl+Shift+R',
click: () => {
this.mainWindow.webContents.send('reload-url', {
ignoreCache: true,
});
},
},
{
label: 'Toggle &Full Screen',
accelerator: 'F11',
@ -268,6 +291,15 @@ export default class MenuBuilder {
this.mainWindow.webContents.send('reload-url');
},
},
{
label: 'Reload Ignoring Cache',
accelerator: 'CommandOrControl+Shift+R',
click: () => {
this.mainWindow.webContents.send('reload-url', {
ignoreCache: true,
});
},
},
{
label: 'Toggle &Full Screen',
accelerator: 'F11',