fix(frontend): show reconnect alert only if note has been loaded

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-09-09 10:17:43 +02:00
parent 1045f34d7d
commit 38b5300ea4

View file

@ -16,6 +16,21 @@ import React from 'react'
*/ */
export const EditorAppBar: React.FC = () => { export const EditorAppBar: React.FC = () => {
const isSynced = useApplicationState((state) => state.realtimeStatus.isSynced) const isSynced = useApplicationState((state) => state.realtimeStatus.isSynced)
const noteDetailsExist = useApplicationState((state) => !!state.noteDetails)
return <BaseAppBar>{isSynced ? <NoteTitleElement /> : <RealtimeConnectionAlert />}</BaseAppBar> if (!noteDetailsExist) {
return <BaseAppBar />
} else if (isSynced) {
return (
<BaseAppBar>
<NoteTitleElement />
</BaseAppBar>
)
} else {
return (
<BaseAppBar>
<RealtimeConnectionAlert />
</BaseAppBar>
)
}
} }