1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

fix window reloading

This commit is contained in:
Andrew Simachev 2024-04-22 20:41:55 +02:00
parent ba1ddcee0c
commit d8181e9229
No known key found for this signature in database
GPG key ID: 49A163D0D14E6FD8
5 changed files with 13 additions and 8 deletions

View file

@ -47,8 +47,7 @@ powerMonitor.on('suspend', () => {
});
powerMonitor.on('resume', () => {
BrowserWindow.getAllWindows().forEach(win => win.webContents.reload());
WindowManager.reloadAll();
Util.log('info', '[PowerMonitor] resume');
});

View file

@ -210,6 +210,11 @@ class Api {
WindowManager.createChallenge(param);
};
reload (win, route) {
win.route = route;
win.webContents.reload();
};
};
module.exports = new Api();

View file

@ -236,7 +236,6 @@ class Util {
];
};
translate (key) {
const lang = this.getLang();
const defaultData = require(`../../dist/lib/json/lang/en-US.json`);

View file

@ -228,13 +228,11 @@ class WindowManager {
sendToAll () {
const args = [ ...arguments ];
this.list.forEach(it => {
Util.send.apply(this, [ it ].concat(args));
});
this.list.forEach(it => Util.send.apply(this, [ it ].concat(args)));
};
reloadAll () {
this.list.forEach(it => it.webContents.reload());
this.sendToAll('reload');
};
};

View file

@ -278,9 +278,9 @@ class App extends React.Component<object, State> {
Renderer.on('leave-full-screen', () => commonStore.fullscreenSet(false));
Renderer.on('logout', () => authStore.logout(false, false));
Renderer.on('data-path', (e: any, p: string) => commonStore.dataPathSet(p));
Renderer.on('shutdownStart', () => {
this.setState({ loading: true });
Storage.delete('menuSearchText');
});
@ -301,6 +301,10 @@ class App extends React.Component<object, State> {
keyboard.setPinChecked(false);
UtilRouter.go('/auth/pin-check', { replace: true, animate: true });
});
Renderer.on('reload', () => {
Renderer.send('reload', UtilRouter.getRoute());
});
};
onInit (e: any, data: any) {