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

@ -103,6 +103,7 @@ const createProps = (): PropsType => ({
addCustomColor: action('addCustomColor'),
closeSettings: action('closeSettings'),
doDeleteAllData: action('doDeleteAllData'),
doneRendering: action('doneRendering'),
editCustomColor: action('editCustomColor'),
getConversationsWithCustomColor: () => Promise.resolve([]),
initialSpellCheckSetting: true,

View file

@ -78,6 +78,7 @@ export type PropsType = {
addCustomColor: (color: CustomColorType) => unknown;
closeSettings: () => unknown;
doDeleteAllData: () => unknown;
doneRendering: () => unknown;
editCustomColor: (colorId: string, color: CustomColorType) => unknown;
getConversationsWithCustomColor: (
colorId: string
@ -164,6 +165,7 @@ export const Preferences = ({
defaultConversationColor,
deviceName = '',
doDeleteAllData,
doneRendering,
editCustomColor,
getConversationsWithCustomColor,
hasAudioNotifications,
@ -251,6 +253,10 @@ export const Preferences = ({
document.body.classList.toggle('dark-theme', theme === ThemeType.dark);
}, [theme]);
useEffect(() => {
doneRendering();
}, [doneRendering]);
useEffect(() => {
const handler = (event: KeyboardEvent) => {
if (event.key === 'Escape') {