PeteAUK / warscroll-designer

A Warscroll creation tool for the Age of Sigmar system (issue tracker)
0 stars 0 forks source link

Saves getting corrupted by undefined name #13

Closed exonian closed 1 year ago

exonian commented 1 year ago

Describe the bug The name doesn't update until the field is focussed out of. If you save the scroll having only entered the name and not focussed out, that's undefined and the save system doesn't like that...

To Reproduce Create a new scroll. Type a name. Don't focus out. Hit "save". The scroll will list as "undefined". You can then rename it, and save it again, and it shows in the list as its new name, but I think its id must still be "undefined" as I can't load it and the console suggests it's looking for undefined still

Expected behaviour The scroll should not get into a broken state

Screenshots image image

Desktop (please complete the following information):

Additional context Sorry for being such a nuisance! 😅 I was saving early to try to check something for a feature request I have for an "are you sure" before creating a new scroll that would discard your changes, and wanted to check how it currently interacts with a saved scroll so saved it earlier than one probably normally would

exonian commented 1 year ago

I think my account is pretty boned now so can't do any more investigation myself as nothing (in terms of saving and loading) seems to be working at all for me now

PeteAUK commented 1 year ago

That's very odd! You shouldn't be able to save a warscroll without something having changed, which generally only occurs on a blur event, so I'm perplexed where the undefined is coming from 🤔.

It looks like something has tripped the javascript over, which would explain why nothing is working now! Are there any other errors in the console? It could be worth clearing the cookies for the site and attempting a second punt just on the off-chance, knowing you had other issues earlier it may be this problem came from those

exonian commented 1 year ago

I'm out and about now so will take another look later and report any console stuff. I definitely cleared cookies and site data since hitting this, and also encounter issues on my phone, but it's quite possible I never cleared them between your sign-up fix and causing this issue. In case I've somehow got a weird broken scroll into my account, is there a way to delete it / my account in case the clear slate is what I need?

PeteAUK commented 1 year ago

Not a problem - appreciate you taking the time to report and investigate these issues. I've checked and there are no warscrolls saved on the database. To clear the local storage use this command in the console:

localStorage.clear()

exonian commented 1 year ago

OK. No luck from clearing localStorage, both via console and via Firefox's "Clear cookies and site data", including making sure I close the tab and don't just refresh it (as I've been burned by that with certain web apps before, although without a service worker I guess that was unlikely to be it here).

Local saving is working fine but once I log in to Google, now when I try to save one I get no response and the following errors: image

PeteAUK commented 1 year ago

I'm fairly confident that this is now fixed.

In simple terms the warscroll tag wasn't correctly generating when saving to the server, this caused an error and resulted in it not saving at all. This wasn't happening on my local dev server which explains why I couldn't replicate it.

The second issue was that for server saves, the menu was trying to update the listing before it had received a response - running locally the speed was such that I'd always received a response when this happened, however my live server isn't particularly quick so there was a delay.

I've also implemented some cache busting bits. Browsers are a nightmare at not correctly spotting when a JS file has changed, so I've added a timestamp onto the main application file.

exonian commented 1 year ago

Brilliant, thanks! Can confirm it works for me now :)

exonian commented 1 year ago

You shouldn't be able to save a warscroll without something having changed

This is no longer having any adverse effects that I can find, but it's still there for me. So out of curiosity: after I hit "save" or "new", the save button is not disabling. But if I reload the page, it'll be disabled. So if at any point I save or hit new, I can then save with no scroll content until I refresh the page.