Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tasks sometimes don't get saved #1138

Open
SqAtx opened this issue Sep 15, 2024 · 7 comments
Open

New tasks sometimes don't get saved #1138

SqAtx opened this issue Sep 15, 2024 · 7 comments
Labels
bug regression Essential features that recently broke reproducible-in-git Issues that affect the current dev version

Comments

@SqAtx
Copy link
Contributor

SqAtx commented Sep 15, 2024

rm -rf .local_build/
./launch.sh

Create a task using the + in the top left
Upon closing the modal, the task doesn't get created.

The Quick Add at the bottom works.

I'll git bisect to figure out when this broke.

GTG: 0.7-dev-8a8d7497
Flatpak: False
Snap: False
Display Name: wayland-0
Desktop: ubuntu:GNOME

lxml: True
caldav: True
liblarch: False
Cheetah3: False
dbus-python: False
pdflatex: False
pypdftk: False

OS: Ubuntu 24.04 LTS
Python: CPython 3.12.3
GLib: 2.80.0
PyGLib: 3.48.2
PyGObject: 3.48.2
GTK: 4.2.14

@SqAtx SqAtx added bug priority:critical reproducible-in-git Issues that affect the current dev version regression Essential features that recently broke labels Sep 15, 2024
@SqAtx
Copy link
Contributor Author

SqAtx commented Sep 15, 2024

I can repro with old commits too, which could indicate something wrong with my test setup. Like I didn't clean a build folder or something.

Except that I can also repro one the 0.7-dev-20240913 flatpak! Even installed from scratch. I did the following:

rm -rf ~/.var/app/org.gnome.GTG.Devel
flatpak remove org.gnome.GTG.Devel
flatpak install org.gnome.GTG.Devel.flatpak

Then run the flatpak, click the +, give a random title, close the modal. The task isn't anywhere to be found (in the app or in the data file).

Fascinating bug. Is anyone able to reproduce it or should I just toss my laptop into the ocean? :)

@SqAtx
Copy link
Contributor Author

SqAtx commented Sep 21, 2024

Curiouser and curiouser. This has happened on my work computer too, and it's running an old (1-2 months) flatpak.

@gycsaba96
Copy link
Contributor

Hi @SqAtx,

Fascinating bug. Is anyone able to reproduce it or should I just toss my laptop into the ocean? :)

It is indeed exciting. No need to toss your laptop into the ocean, I don't think the turtles would like it. 🐢 😉

I started logging the input and the return value of the Task.is_new method. It shows the original "New Task" title and a True return value causing the problem. However, it is not consistent, sometimes it works as expected.

@SqAtx
Copy link
Contributor Author

SqAtx commented Nov 11, 2024

Yep, seeing the same thing.
In the task editor destructor, we do

        if self.is_new():
            self.app.ds.tasks.remove(tid)
        else:
            self.save()

and amazingly, is_new() returns True because the task's title (and raw_title) is still the default and its content is empty.

Interestingly, if I pre-select a tag before clicking the + to create the task, the @tag is already present when the editor opens, and that makes it into content so the task is saved.


I noticed that when the problem happens, TaskEditor.save() wasn't called when the task editor was closed. It's always called when the editor is opened (that's what adds the @tag when the tag is selected before creating the task), but not always when it's closed. And of course, if that's not called then nothing is setting the task attributes and it's like you never typed anything in the editor.

@gycsaba96
Copy link
Contributor

Good points! If I see the situation correctly, we should just ensure that each is_new() call involves a prior save().

(Fun fact regarding the inconsistent reproducibility: if you stop for 5 seconds while typing your new task title, it is saved as expected.)

@SqAtx
Copy link
Contributor Author

SqAtx commented Nov 14, 2024

Ahhh that must be it! Pretty sure we save periodically. And likely we also save when automatically adding tags in the scenario I described above. But as you say, I guess we're not saving when the editor gets closed and before doing anything else.

That would be good news. If the auto save happens every 5 seconds as you describe, then this is not a very common problem and that's why I'd rarely seen it outside of tests.

@SqAtx SqAtx changed the title New tasks no longer get saved New tasks sometimes don't get saved Nov 14, 2024
@SqAtx
Copy link
Contributor Author

SqAtx commented Nov 17, 2024

The problem seems to be that within .desctruction(), self.textview.get_title() is the title I set but self.task.title is "New Task". Same with the contents.

We can't just blindly call .save() at the beginning of .desctruction(), since we wouldn't save the correct data.

I wonder if self.textview.process() is supposed to set the correct data on self.task.

Anyway that's all the time I had for today. Writing notes for future me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug regression Essential features that recently broke reproducible-in-git Issues that affect the current dev version
Projects
None yet
Development

No branches or pull requests

3 participants