mirror of
https://github.com/laurent22/joplin.git
synced 2025-01-02 12:47:41 +02:00
Desktop: Fix invalid tag state issue when importing notes or syncing
This commit is contained in:
parent
98f822d89c
commit
a5d7366f94
@ -8,8 +8,9 @@ export const declaration:CommandDeclaration = {
|
||||
export const runtime = (comp:any):CommandRuntime => {
|
||||
return {
|
||||
execute: async (_context:CommandContext, message:string) => {
|
||||
let brIndex = 1;
|
||||
const lines = message.split('\n').map((line:string) => {
|
||||
if (!line.trim()) return <br/>;
|
||||
if (!line.trim()) return <br key={`${brIndex++}`}/>;
|
||||
return <div key={line} className="text">{line}</div>;
|
||||
});
|
||||
|
||||
|
@ -66,10 +66,23 @@ class Tag extends BaseItem {
|
||||
note_id: noteId,
|
||||
});
|
||||
|
||||
this.dispatch({
|
||||
type: 'TAG_UPDATE_ONE',
|
||||
item: await Tag.loadWithCount(tagId),
|
||||
});
|
||||
// While syncing or importing notes, the app might associate a tag ID with a note ID
|
||||
// but the actual items might not have been downloaded yet, so
|
||||
// check that we actually get some result before dispatching
|
||||
// the action.
|
||||
//
|
||||
// Fixes: https://github.com/laurent22/joplin/issues/3958#issuecomment-714320526
|
||||
//
|
||||
// Also probably fixes the errors on GitHub about reducer
|
||||
// items being undefined.
|
||||
const tagWithCount = await Tag.loadWithCount(tagId);
|
||||
|
||||
if (tagWithCount) {
|
||||
this.dispatch({
|
||||
type: 'TAG_UPDATE_ONE',
|
||||
item: tagWithCount,
|
||||
});
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user