I was pressing cntr-s and believed that I was getting positive feedback that it was saving but after a short network problem, I found that the last saved draft was 23 hours old.
I suspect that you need to change the browser side code to require positive confirmation of a save rather than taking the absense of an error as indication of success.
Also, you could save each cntr-s draft as a separate row and instead of deleting them, set a deleted column to true. Then use a cron job to remove deleted row that are over N days old.
Steps To Reproduce
Steps to reproduce the behavior:
- I was taking notes in a page while researching. I was pressing cntr-s often and I was aware of the "draft saved" msg and believed at the time that I was getting positive feedback that cntr-s was working. During that time I put me notebook to sleep several times. I actually thought that cntr-s was the same as pressing "save page" followed by "edit" to keep editting. I did not understand draft vs revision at the time. Its hard to say what exactly I saw after pressing cntr-s but I know that I got some feedback and it was probably the same that I see now -- a checkbox appears for a time. I did not notice at teh time whether the timestamp updated.
- After a wifi network blip, I got a popup near the "save page" button saying that the page could not be saved because the server could not be reached. (did not record the exact text).
- I fixed the wifi issue by connecting to a different SSID which would have changed my local IP.
- I confirmed that connectivity was back by using a new browser window.
- I pressed "save page" and was greeted with a "419|Page Expired" Error.
- Page was then empty, but pressing "edit" filled in 23 hour old content.
Expected behavior
Not to have my hard work pissed away!
Your Configuration (please complete the following information):
- BookStack v0.29.3
- PHP Version: 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS )
- Hosting Method (Nginx/Apache/Docker): NGINX on Ubuntu 20.04 server
Additional context
Discord transcript:
bobgToday at 11:56 AM
I just lost a day of research notes! I was hitting cntrl-s often, and I know that I saw a msg about the page being saved, yet when I just had a network blip, my page went back to empty! I queried page_revisions table and found only the initial save with a fraction of the content. Is there anywhere else I can look to find a more recent version of the content?
the current page is actually blank so I suspect that when I hit 'back' in the browser it resulted in the browser having an empty page and then submitting that empty page
any ideas?
been using bookstack for a week and was loving it up to now 😦
bobgToday at 12:07 PM
what is the concept of a "draft"? Is that stored in a different place than a "revision"? Experimenting on a different page, the message I remeber seeing was "draft saved"
bobgToday at 12:16 PM
weel, I dumped the entire DB and serached for keywords -- the draft is not in the DB anywhere.
I assume thats it. no where else it could be. I would appreciate any confirmation of that before I move on.
bobgToday at 12:34 PM
So now I do see that initial commit of the page with some data in the page_revisions table but when I go to revisions in the UI, even though It lists one revision clicking on the "changes" and on "current" results in no content being shown? I can get the content string directly from the DB, how do I get that back into my page?
ssddanbrownToday at 12:45 PM
@bobg A revision is a published version of the page. A draft is user-specific draft content for a page.
What type is the row in the DB where you've found your content?
bobgToday at 12:46 PM
I think its a update_draft
ssddanbrownToday at 12:47 PM
Okay, There should be a user_id or something on that row, does it match the id of your user?
bobgToday at 12:47 PM
(I am using the mysql cmdline and the formatting of columns in hard to line up)
yes -- created_by = 3 which is me
ssddanbrownToday at 12:52 PM
I'd expect that content to be restored into the editor when you go to edit the page again, Should pop up a message like "Here's content you were editing earlier" .
bobgToday at 12:52 PM
oh. maybe if I just hit "edit" in the UI it will populate with my draft?
ssddanbrownToday at 12:53 PM
Should do, Make sure you have a copy of that DB first, just in case
bobgToday at 12:53 PM
good idea:) -- will do
that 'worked"
this draft was from 23 hours ago it says:(
so why was it letting me press cntr-s for a day without actually saving the draft?
I can not say for sure that I was seeing the "draft saved" message but I am pretty sure that I was -- I know it registered that cntr-s was doing something
after the network blip, I got a message about not saving so after network was back, I hit "save page" and that got a "4xx|Page Expired" msg. (I think it was 417)
I can not remember the last time I had a content lost error like this. It is painful because I was keeping really good notes!
but anyway, thanks for your help
ssddanbrownToday at 1:37 PM
@bobg Yeah, That's a harsh situation , apologies. I think someone else did report something similar but I had trouble re-producing it. Might need to double check the autosave logic to ensure we're always throwing errors when needed, think some cases have appeared where the save fails but a garbled success message pops up.
Autosave can always be tricky there as there's the risk of autosaving bad content off the back of another issue.
If you can re-produce the scenario in any manner make sure to file a bug so we can address it.
bobgToday at 1:44 PM
yes, after I understood the draft vs versions, I assumed that the problem would be that it had been saving but the last save was empty. I am very surprised to find that it had not had a succesfull save in 23 hours
in what ever IPC you are using. the browser side thought it was a success when the server side was not successfull. That should be solved in the protocol so that it can not happen. the browser needs a positive confirmation of success as opposed to a lack of an error.
I actually thought that cntr-s was the same as "page save" + "edit". There was no indication that saving in that manner was more risky.
bobgToday at 2:00 PM
each draft save could produce an update_draft+(countCol++) revision and instead of deleting them on "page save", you just toggle a deleted column on all those rows. Then a cron job removes deleted drafts older than N days.
I was pressing cntr-s and believed that I was getting positive feedback that it was saving but after a short network problem, I found that the last saved draft was 23 hours old.
I suspect that you need to change the browser side code to require positive confirmation of a save rather than taking the absense of an error as indication of success.
Also, you could save each cntr-s draft as a separate row and instead of deleting them, set a deleted column to true. Then use a cron job to remove deleted row that are over N days old.
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
Not to have my hard work pissed away!
Your Configuration (please complete the following information):
Additional context
Discord transcript:
bobgToday at 11:56 AM
I just lost a day of research notes! I was hitting cntrl-s often, and I know that I saw a msg about the page being saved, yet when I just had a network blip, my page went back to empty! I queried page_revisions table and found only the initial save with a fraction of the content. Is there anywhere else I can look to find a more recent version of the content?
the current page is actually blank so I suspect that when I hit 'back' in the browser it resulted in the browser having an empty page and then submitting that empty page
any ideas?
been using bookstack for a week and was loving it up to now 😦
bobgToday at 12:07 PM
what is the concept of a "draft"? Is that stored in a different place than a "revision"? Experimenting on a different page, the message I remeber seeing was "draft saved"
bobgToday at 12:16 PM
weel, I dumped the entire DB and serached for keywords -- the draft is not in the DB anywhere.
I assume thats it. no where else it could be. I would appreciate any confirmation of that before I move on.
bobgToday at 12:34 PM
So now I do see that initial commit of the page with some data in the page_revisions table but when I go to revisions in the UI, even though It lists one revision clicking on the "changes" and on "current" results in no content being shown? I can get the content string directly from the DB, how do I get that back into my page?
ssddanbrownToday at 12:45 PM
@bobg A revision is a published version of the page. A draft is user-specific draft content for a page.
What type is the row in the DB where you've found your content?
bobgToday at 12:46 PM
I think its a update_draft
ssddanbrownToday at 12:47 PM
Okay, There should be a user_id or something on that row, does it match the id of your user?
bobgToday at 12:47 PM
(I am using the mysql cmdline and the formatting of columns in hard to line up)
yes -- created_by = 3 which is me
ssddanbrownToday at 12:52 PM
I'd expect that content to be restored into the editor when you go to edit the page again, Should pop up a message like "Here's content you were editing earlier" .
bobgToday at 12:52 PM
oh. maybe if I just hit "edit" in the UI it will populate with my draft?
ssddanbrownToday at 12:53 PM
Should do, Make sure you have a copy of that DB first, just in case
bobgToday at 12:53 PM
good idea:) -- will do
that 'worked"
this draft was from 23 hours ago it says:(
so why was it letting me press cntr-s for a day without actually saving the draft?
I can not say for sure that I was seeing the "draft saved" message but I am pretty sure that I was -- I know it registered that cntr-s was doing something
after the network blip, I got a message about not saving so after network was back, I hit "save page" and that got a "4xx|Page Expired" msg. (I think it was 417)
I can not remember the last time I had a content lost error like this. It is painful because I was keeping really good notes!
but anyway, thanks for your help
ssddanbrownToday at 1:37 PM
@bobg Yeah, That's a harsh situation , apologies. I think someone else did report something similar but I had trouble re-producing it. Might need to double check the autosave logic to ensure we're always throwing errors when needed, think some cases have appeared where the save fails but a garbled success message pops up.
Autosave can always be tricky there as there's the risk of autosaving bad content off the back of another issue.
If you can re-produce the scenario in any manner make sure to file a bug so we can address it.
bobgToday at 1:44 PM
yes, after I understood the draft vs versions, I assumed that the problem would be that it had been saving but the last save was empty. I am very surprised to find that it had not had a succesfull save in 23 hours
in what ever IPC you are using. the browser side thought it was a success when the server side was not successfull. That should be solved in the protocol so that it can not happen. the browser needs a positive confirmation of success as opposed to a lack of an error.
I actually thought that cntr-s was the same as "page save" + "edit". There was no indication that saving in that manner was more risky.
bobgToday at 2:00 PM
each draft save could produce an update_draft+(countCol++) revision and instead of deleting them on "page save", you just toggle a deleted column on all those rows. Then a cron job removes deleted drafts older than N days.