Android Update + cursor jumping = accidently deleted notes

I'm not sure if anyone else is experiencing this. Since updating my Android Galaxy S10 as of 3/28/2022, my cursor has been jumping in the mobile app A LOT. I'll type about 10 characters and the cursor just starts jumping as I'm typing.

I just noticed I accidently deleted a large portion of my notes.

I wrote a quick python script to be run against the desktop version of the sqlite database to check for note revisions that are quite large (in this case, deleting more than 300 characters).

This is the python script I ran on my Windows 11 machine.


import sqlite3
import json
import datetime

db_path = "C:\\Users\\USER\\.config\\joplin-desktop\\" + "database.sqlite"

con = sqlite3.connect(db_path)
cur = con.cursor()
cur2 = con.cursor()

output_data = []
for row in cur.execute('''SELECT id, item_id, item_updated_time, title_diff, body_diff FROM revisions'''):
    id = row[0]
    title = cur2.execute(f'''SELECT title FROM notes WHERE id = "{row[1]}"''').fetchone()
    item_updated_time = row[2]
    title_diff = json.loads(row[3])
    body_diff = json.loads(row[4])
       
    obj = {}
    obj['item_updated_time'] = str(datetime.datetime.fromtimestamp(1649080438313 / 1000))
    try:
        obj["Title"] = title[0]
    except Exception as e:
        obj["Title"] = "ERROR GETTING TITLE"

    total_diff_length = 0
    for diff in body_diff:
        total_diff_length += (diff['length2'] - diff['length1'])
    obj['total_diff_length'] = total_diff_length

    output_data.append(obj)

# print affected notes
[print(obj) for obj in output_data if obj["total_diff_length"] < -300]

This helped me find another 4 notes where I deleted upwards of 1000-9000 characters. So a significant amount of notes could have been invisibly lost.

It would be nice to see a feature in the future to view all revision history in a table and filter, but I just wanted to bring this to the community's awareness in case anyone else needs help finding notes they potentially accidently deleted.

The output should look something like this, where you can view the time of the entry and the number of characters deleted from each note. From there just go into that note's revision history to validate and recover your lost data before it's permanently deleted.

2 Likes

FWIW, I had this exact experience today, on Android, but in Obsidian. Perhaps both are using the same kind of text-entry box, and that's what's screwed up.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.