1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Desktop: Fixes #6416: Switching a note using Sidebar is slow and grayed out (#6430)

This commit is contained in:
Kenichi Kobayashi
2022-11-15 02:25:41 +09:00
committed by GitHub
parent a2de167b95
commit 5d49fcfe4e
2 changed files with 27 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import useWindowCommandHandler from './utils/useWindowCommandHandler';
import useDropHandler from './utils/useDropHandler';
import useMarkupToHtml from './utils/useMarkupToHtml';
import useFormNote, { OnLoadEvent } from './utils/useFormNote';
import useEffectiveNoteId from './utils/useEffectiveNoteId';
import useFolder from './utils/useFolder';
import styles_ from './styles';
import { NoteEditorProps, FormNote, ScrollOptions, ScrollOptionTypes, OnChangeEvent, NoteBodyEditorProps, AllAssetsOptions } from './utils/types';
@ -66,9 +67,11 @@ function NoteEditor(props: NoteEditorProps) {
setTitleHasBeenManuallyChanged(false);
}, []);
const effectiveNoteId = useEffectiveNoteId(props);
const { formNote, setFormNote, isNewNote, resourceInfos } = useFormNote({
syncStarted: props.syncStarted,
noteId: props.noteId,
noteId: effectiveNoteId,
isProvisional: props.isProvisional,
titleInputRef: titleInputRef,
editorRef: editorRef,
@ -192,7 +195,7 @@ function NoteEditor(props: NoteEditorProps) {
setScrollWhenReady({
type: props.selectedNoteHash ? ScrollOptionTypes.Hash : ScrollOptionTypes.Percent,
value: props.selectedNoteHash ? props.selectedNoteHash : props.lastEditorScrollPercents[props.noteId] || 0,
value: props.selectedNoteHash ? props.selectedNoteHash : props.lastEditorScrollPercents[formNote.id] || 0,
});
void ResourceEditWatcher.instance().stopWatchingAll();
@ -550,7 +553,7 @@ function NoteEditor(props: NoteEditorProps) {
}
}
if (formNote.encryption_applied || !formNote.id || !props.noteId) {
if (formNote.encryption_applied || !formNote.id || !effectiveNoteId) {
return renderNoNotes(styles.root);
}