buff0000n / dojocad

Dojo planner/builder for Warframe
MIT License
27 stars 7 forks source link

Local storage overwrite #35

Closed DANser-freelancer closed 1 year ago

DANser-freelancer commented 1 year ago

I can save the dojo to local storage, and when I refresh the page or close and open the page it will appear again. But when I get the prompt to overwrite (when I save new dojo layout with the same name) and choose "yes" - it holds the blueprint if I refresh but it doesn't if I close and open the window. Whcih means it probably doesn't go to local storage after "overwrite?" prompt.

DANser-freelancer commented 1 year ago

I can save the dojo to local storage, and when I refresh the page or close and open the page it will appear again. But when I get the prompt to overwrite (when I save new dojo layout with the same name) and choose "yes" - it holds the blueprint if I refresh but it doesn't if I close and open the window. Whcih means it probably doesn't go to local storage after "overwrite?" prompt.

Edit: I can bring out the saved dojo manually, it's just the page for some reason automatically loading old save version instead of the latest one (even though I only have one single save file).

buff0000n commented 1 year ago

@DANser-freelancer Huh, I can't reproduce the problem. What browser? Can you give me more details about exactly what you're doing? What are you clicking on, when are you clicking on it, and when do the page reloads happen?

When you overwrite an existing entry, do you see the timestamp of that entry update?

DANser-freelancer commented 1 year ago

@DANser-freelancer Huh, I can't reproduce the problem. What browser? Can you give me more details about exactly what you're doing? What are you clicking on, when are you clicking on it, and when do the page reloads happen?

When you overwrite an existing entry, do you see the timestamp of that entry update?

Look, this is what happens video, I use Opera.

buff0000n commented 1 year ago

@DANser-freelancer Oh, wow, Opera is still a thing?

Anyway, I see what's going on. If you look carefully at your bookmark, it has a hard-coded dojo layout embedded in it:

Screen Shot 2023-03-05 at 4 03 39 PM

DojoCAD continually updates the current URL, saving your current layout in your browser history in case something happens to your browser session. It looks like Opera hides all that by default for some reason. To see it in Opera, go to Settings -> Browser -> User Interface -> Show full URL in combined search and address bar.

I'll admit that complicates bookmarking if you wait until you've done some work in it before adding it as a bookmark. There is an auto-save function that continually saves the currently layout to local storage, but I'm uncomfortable with removing the address bar updates and relying only on auto-save for disaster recovery. Let me give it some thought.

DANser-freelancer commented 1 year ago

Wdym "still a thing"? Opera is just....Opera.. it's a browser.
Anyways, it happens because I opened a bookmark but if I open it from a general link it starts completely fresh.
I though you had some code to auto load the latest save and it was bugged.

buff0000n commented 1 year ago

@DANser-freelancer

I though you had some code to auto load the latest save and it was bugged.

Well, kind of. If you enable Menu -> Settings -> Autosave, then it will continually save your current layout to a special "Autosave" entry in Local Storage. If you reload DojoCAD without any hard-coded layout in the URL then it will load your last Autosave, no explicit saving required. Like I said, I might consider dropping the URL updating in favor of just Autosave, but I'm not sure about it.