Thanks for working on this module. Well crafted and styled. When I load FoundryVTT with a player user I get the following error in the console. ## Error message ```js Uncaught (in promise) SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at loadWindowPositions (utils.js:15:25) at Module.restoreWindows (utils.js:26:2) at Function.onReady (Monarch.js:219:9) | loadWindowPositions | @ | utils.js:15 -- | -- | -- | -- | restoreWindows | @ | utils.js:26 | onReady | @ | Monarch.js:219 | await in onReady (async) | | | _call | @ | foundry.js:294 | callAll | @ | foundry.js:253 | setupGame | @ | foundry.js:5566 | await in setupGame (async) | | | _initializeGameView | @ | foundry.js:6498 | _initializeView | @ | foundry.js:6474 | initialize | @ | foundry.js:5430 | await in initialize (async) | | | 🎁call_wrapped | @ | libWrapper-wrapper.js:511 | 🎁libWrapperInit | @ | libWrapper-api.js:793 | await in 🎁libWrapperInit (async) | | | 🎁Game.prototype.initialize#0 | @ | libWrapper-wrapper.js:187 | window.addEventListener.once | @ | foundry.js:62436 ``` Not sure if this connected to the players. Or if this could also happen as GM. with the GM account however, I do not get this error. ## further resources https://stackoverflow.com/questions/30621802/why-does-json-parse-fail-with-the-empty-string ## Potential solution ### Old https://github.com/zeel01/monarch/blob/04badbf35ac75f738cbb65142e3025c8134ade09/scripts/utils.js#L14 ### New ```js const data = window.localStorage.getItem("monarch-windows") || '{}'; ``` ## Explanation of the change When using the "Old" from above in https://github.com/zeel01/monarch/blob/04badbf35ac75f738cbb65142e3025c8134ade09/scripts/utils.js#L15 The variable `data` is an empty string. Which `JSON.parse` can't parse. Using either `"{}"` or maybe `'""'` (double quotes in single quotes) should yield the desired behavior. This should also make the `|| {}` in line 15 obsolete I think. As data will always be a parsable string. This could be wrong if `window.localStorage.getItem("monarch-windows")` will return something else then valid json or null.
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by DanielBoettner and has received 2 comments.