Moerill / fvtt-find-the-culprit

MIT License
8 stars 10 forks source link

game.settings.set is not a function errors #36

Closed mkahvi closed 1 year ago

mkahvi commented 1 year ago

FtC 1.4.5 w/ Foundry 10.286, didn't happen in previous version of FtC.

Starting the process:

find-the-culprit.js:350 Uncaught (in promise) TypeError: game.settings.set(...) is not a function
[Detected 1 package: find-the-culprit]
    at deactivationStep (find-the-culprit.js:350:3)
    at Object.callback (find-the-culprit.js:78:11)

Reactivating all modules:

Uncaught (in promise) TypeError: game.settings.set(...) is not a function
    at reactivateModules (find-the-culprit.js:361:3)
    at Object.callback (find-the-culprit.js:239:25)
    at Dialog.submit (foundry.js:55745:35)
    at Dialog._onClickButton (foundry.js:55674:10)
    at HTMLButtonElement.dispatch (jquery.min.js:2:43064)
    at y.handle (jquery.min.js:2:41048)

Manually refreshing after makes things work as expected though? Expect when attempting to reactivate all.

mkahvi commented 1 year ago

The problem is I think because the game.settings.set is not terminated with semicolon, so the line after gets run in because of parenthesis usage.

As in, it tries to call a function returned by game.settings.set() but it doesn't return a function, so it errors.

set()
(blah)()

is same as

set()(blah)()
mkahvi commented 1 year ago

Just noticed there's new version with fix for this, nevermind.