League-of-Foundry-Developers / foundryvtt-forien-copy-environment

8 stars 7 forks source link

[BUG] Settings of object type are not exported correctly. #23

Closed kimitsu closed 2 years ago

kimitsu commented 2 years ago

Describe the bug Some settings of type Object are not imported correctly, for example if the default value of these settings is an empty object {}.

To Reproduce Steps to reproduce the behavior:

  1. Install Force Client Settings along with Forien Copy Environment
  2. Go to settings config and tap some of the locks.
  3. Export settings via the context menu on the General Information panel.
  4. Inspect the file to find that "force-client-settings.forced" setting is missing.

Expected behavior FCE should export all settings that are offset from their default values.

Foundry Version: 9.269

Additional context Apparently, FCE relies on diffObject from helpers.mjs to verify if the setting value is different from the default. Unfortunately, that function does not work properly in most cases, as it only checks for the keys that are present in the second passed object (in this case, the empty object), The solution would be to either reimplement that function or just compare JSON stringified values. I'm not sure if it's wise to report this on FoundryVTT issue tracker to make them fix that function, because some code may be reliant on this "bug"

kimitsu commented 2 years ago

Related issue: https://github.com/League-of-Foundry-Developers/foundryvtt-forien-copy-environment/issues/22 Fixing this should fix failing to export "core.keybindings"