DarylBuckle / dnd-character-sheets

Dungeons and Dragons 5th Edition character sheets created in ReactJS.
https://dnd5esheets.com
MIT License
78 stars 25 forks source link

Import stops working after a bad JSon is passed #8

Closed Amerisun closed 2 years ago

Amerisun commented 2 years ago

I am writing a tool to use Fantasy Grounds XML exports, writing XSL to parse that and turn it into your JSON format so the Fantasy Grounds community can use your sheets to manually print out their characters. https://github.com/Amerisun/FantasyGroundsXMLConverter

During debugging this and trying, I had to send lots of bad JSON files through. If I click import, and there is a bad JSON passed, I noticed that any attempts after that fail for the same JSON file. I have to click "Clear" and then refresh the page for it to allow importing again for that same JSON.

But I can import other JSON files fine.

Steps to reproduce

  1. Write a BADLY formatted JSON and try to import. Filename mybadchar.json.
  2. Fix the file to be a good format.
  3. Import doesn't work.

This will make it work:

  1. Write badly formatted JSON. Filename mybadchar.json
  2. Import another character that's well formatted. Filename mygoodchar.json
  3. Fix the previous file and reimport
  4. Import works.

I can also click clear, and refresh the page and the badchar will load the second time after fixing it.

Hope this is clear enough. :-)

DarylBuckle commented 2 years ago

Hi @Amerisun,

Sounds great. It would be useful for this project to be able to import from other sources as well, so an import from Fantasy Grounds option could be something worth adding to the roadmap.

Thanks for raising this issue and for the detailed steps to reproduce. I'll put a fix in place for this issue shortly.