Joplin: API: Updated note not reloaded

Created on 13 Feb 2020  路  10Comments  路  Source: laurent22/joplin

I am using a script to update notes using the Joplin API. Sometimes the note I update is currently open in Joplin-desktop.

When I use the API to update a note which is open, the note does not get reloaded in Joplin.

I have to click on another note and than back into the first one to see the updated content. This also means that any content added by the API get overwritten if I edit the note in Joplin before manually reloading it.

This is either intended or a bug.

Environment

Joplin version: 1.0.179 (prod, linux)
Platform: Uubuntu
OS specifcs: 19.10

Steps To Reproduce

  1. Create note in joplin
  2. Open note in joplin
  3. Use API to update (opened) note:
    method put path http://127.0.0.1:41184/notes/f13f7e61f3ad46ab812c9bfa804dfb79 params {'token': '...'} payload {'title': 'test 2020-02-13', 'body': 'init text\nupdated ...\nupdated ...', 'parent_id': 'dbf4a5f9560f49f4a740ae10a8d2050b', 'author': 'DailyJoplin', 'source_url': '', 'is_todo': 0, 'tags': ''} headers {'Content-Type': 'application/json'}

Describe what you expected to happen:

Updated content appears in Joplin.

What happens:

Note gets updated in the background, but change it not visible in Joplin.

Need to re-open note to make updated content visible.

(Content set from API even gets overwritten/is lost if I change the note by hand before reloading it.)

Logfile

Update of note via API

==> log-clipper.txt <==
2020-02-13 20:25:16: "Request: GET /ping/?token=..."

2020-02-13 20:25:16: "Request: GET /folders/dbf4a5f9560f49f4a740ae10a8d2050b/notes?token=...&fields=id%2Cparent_id%2Ctitle%2C+body%2C+created_time%2Cupdated_time%2C+is_conflict%2C+latitude%2C+longitude%2Caltitude%2C+author%2C+source_url%2C+is_todo%2Ctodo_due%2C+todo_completed%2C+source%2C+source_application%2C+order%2Capplication_data%2C+user_created_time%2C+user_updated_time%2C+encryption_cipher_text%2C+encryption_applied"

2020-02-13 20:25:16: "Request: PUT /notes/9870e658186f437cb4216d6799ea1404?token=..."

==> log.txt <==
2020-02-13 20:25:16: "Scheduling sync operation..."

2020-02-13 20:25:26: "SearchEngine: Updating FTS table..."

==> log-database.txt <==
2020-02-13 20:25:26: "Saving settings..."
2020-02-13 20:25:27: "Settings have been saved."

==> log.txt <==
2020-02-13 20:25:27: "SearchEngine: Updated FTS table in 70ms. Inserted: 1. Deleted: 0"

bug stale

All 10 comments

I think the behavior you have described is intended.


When I use the API to update a note which is open, the note does not get reloaded in Joplin.

If the note has to be reloaded in Joplin desktop every time a change is caused by the API, then it would mean that there has to be a reload function that is called repeatedly which I think is costly in terms of processing. The case you have described is IMO an edge case and I (at least personally) as a user wouldn't mind reloading that single note manually.

This also means that any content added by the API get overwritten if I edit the note in Joplin before manually reloading it.

This also works as intended because Joplin saves the note everytime a change is made. So the note (+new changes) made in the desktop app is saved (overwrites note from API).

Note: This is only my take on the issue. Perhaps @laurent22 has some other interesting perspective. I guess he would be the one to decide if this is a bug or if it works as intended.

If the note has to be reloaded in Joplin desktop every time a change is caused by the API, then it would mean that there has to be a reload function that is called repeatedly which I think is costly in terms of processing.

I think reloading whenever there was an update via API would be enough. Since the API server is part of the (desktop) client, I assume it is possible that the editor view receives a notification.

as a user wouldn't mind reloading that single note manually.

My script is adding lines to notes in the background, so I am not aware when this happened, which means manual reloading is not an option.

This also works as intended because Joplin saves the note everytime a change is made. So the note (+new changes) made in the desktop app is saved (overwrites note from API).

Exactly, so there is no way to resolve this apart from automatic reloading whenever the file changed via API.

This also works as intended because Joplin saves the note everytime a change is made. So the note (+new changes) made in the desktop app is saved (overwrites note from API).

Exactly, so there is no way to resolve this apart from automatic reloading whenever the file changed via API.

but it should check if the version, Joplin opened is the latest stored in the database. If not a warning or diff compare should come up, shouldn't it=

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

I think this at least requires a "this is indeed a bug" or a "works as intended, wontfix". :-)

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

@laurent22 can you tell us a bit?
thx

I'm seeing the same issue between two installations of Joplin, following this sequence:
1) Open the same note on computers A and B
2) Modify the note on computer A
3) Press "Synchronize" on computer A
4) Press "Synchronize" on computer B
5) Expected result: the note shown on computer B has the latest content added from computer A. Actual result: Computer B continues to show the old content of the note. I have to click another note and come back before the updated changes are shown.

Synchronization target is OneDrive. Not sure if that matters. Haven't tried other targets.

Any suggestions on what to try? Should I file a separate issue? Not sure if this shares the same root issue as the original post or not, but seems likely to me.

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GuyOlivier picture GuyOlivier  路  37Comments

Cogitri picture Cogitri  路  40Comments

poVoq picture poVoq  路  69Comments

harmancasvi picture harmancasvi  路  34Comments

testman42 picture testman42  路  97Comments