Settings window: Don't show until everything is rendered

This commit is contained in:
Scott Nonnenberg 2021-09-02 08:48:53 -07:00 committed by GitHub
parent bf25a5db0b
commit 30c3b7630c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 22 deletions

View file

@ -43,6 +43,9 @@ window.ReactDOM = ReactDOM;
window.getEnvironment = getEnvironment;
window.getVersion = () => String(config.version);
window.i18n = i18n.setup(locale, localeMessages);
function doneRendering() {
ipcRenderer.send('settings-done-rendering');
}
const settingAudioNotification = createSetting('audioNotification');
const settingAutoDownloadUpdate = createSetting('autoDownloadUpdate');
@ -157,9 +160,9 @@ function getSystemTraySettingValues(
};
}
async function renderPreferences() {
window.renderPreferences = async () => {
if (!renderComponent) {
setTimeout(renderPreferences, 100);
setTimeout(window.renderPreferences, 100);
return;
}
@ -293,6 +296,7 @@ async function renderPreferences() {
addCustomColor: ipcAddCustomColor,
closeSettings: () => ipcRenderer.send('close-settings'),
doDeleteAllData: () => ipcRenderer.send('delete-all-data'),
doneRendering,
editCustomColor: ipcEditCustomColor,
getConversationsWithCustomColor: ipcGetConversationsWithCustomColor,
initialSpellCheckSetting:
@ -377,13 +381,11 @@ async function renderPreferences() {
function reRender<Value>(f: (value: Value) => Promise<Value>) {
return async (value: Value) => {
await f(value);
renderPreferences();
window.renderPreferences();
};
}
renderComponent(Preferences, props);
}
ipcRenderer.on('render', renderPreferences);
};
initializeLogging();