Giter Site home page Giter Site logo

Comments (12)

DarkFalc0n avatar DarkFalc0n commented on August 17, 2024

Which OS has this issue? I run joplin on Arch Linux and it is working instantly for me.

from joplin.

laurent22 avatar laurent22 commented on August 17, 2024

All of them probably

from joplin.

DarkFalc0n avatar DarkFalc0n commented on August 17, 2024

The only probable reason I could find is that the await Note.save(...) holds the event emit (at /packages/app-desktop/gui/NoteList/NoteList.tsx). The emit could be initiated before the save function, because the latter can take up some time for larger notes.

	const noteItem_checkboxClick = async (event: any, item: any) => {
		const checked = event.target.checked;
		const newNote = {
			id: item.id,
			todo_completed: checked ? time.unixMs() : 0,
		};
		await Note.save(newNote, { userSideValidation: true });
		eventManager.emit(EventName.TodoToggle, { noteId: item.id, note: newNote });
	};

from joplin.

nebiyuelias1 avatar nebiyuelias1 commented on August 17, 2024

@DarkFalc0n - so just interchanging the two lines should fix it?

from joplin.

DarkFalc0n avatar DarkFalc0n commented on August 17, 2024

Interchanging could lead to other cases of bad error handling where there is an exception and the note state couldn't be saved but the check will still update. The current order of functions makes more sense since any error in saving the note can be reflected even before updating the list (and the check mark)

from joplin.

DarkFalc0n avatar DarkFalc0n commented on August 17, 2024

It needs more thought to be put into it

from joplin.

G0maa avatar G0maa commented on August 17, 2024

@DarkFalc0n, I think you could interchange them & add e.g. try, catch block:

		eventManager.emit(EventName.TodoToggle, { noteId: item.id, note: newNote });
		try {
			await Note.save(newNote, { userSideValidation: true });
		} catch(e) {
			eventManager.emit(EventName.TodoToggle, { noteId: item.id, note: newNote });
		}

Maybe re-throw the error if needed.

from joplin.

DarkFalc0n avatar DarkFalc0n commented on August 17, 2024

This could definitely work, lets see what others think of this

from joplin.

G0maa avatar G0maa commented on August 17, 2024

Actually, I'm not sure if this particular NoteList.tsx component is being used, I think the one that's being used is NoteList2.tsx.

from joplin.

laurent22 avatar laurent22 commented on August 17, 2024

That's right, we'll need to remove NoteList.tsx. I kept it there for some time just in case there's a major issue with the new note list

from joplin.

G0maa avatar G0maa commented on August 17, 2024

There's a similar logic in NoteList2.tsx anyway 👀

if (changeEvent.elementId === 'todo-checkbox') {
await Note.save({
id: changeEvent.noteId,
todo_completed: changeEvent.value ? Date.now() : 0,
}, { userSideValidation: true });
props.dispatch({ type: 'NOTE_SORT' });

But I'm not sure if it's really what's causing this behaviour, I added few hindered to-dos and it feels the same regardless of commenting the await or not.

from joplin.

G0maa avatar G0maa commented on August 17, 2024

I've been playing around this by adding:

await new Promise(resolve => setTimeout(resolve, 2000));

before Note.save() and props.dispatch(), you can see the behavior in this gif:
2024-03-28 14-26-22

I think the solution I suggested above can't be applied here, props.dispatch() depends on the Note.save().

from joplin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.