UnofficialCrusaderPatch / UCP3-GUI

Dev work on the UCP3 gui
GNU Affero General Public License v3.0
2 stars 0 forks source link

Sparse/full config issue for custom menu objects #204

Closed gynt closed 7 months ago

gynt commented 7 months ago

As mentioned here: https://github.com/UnofficialCrusaderPatch/extension-aiSwapper/issues/3

Solution will be in a PR

The observations: The bug occurs if, and only if, (A) the aiSwapper is included as an active extension, (B) the custom aiswapper menu is used (save & close), (C) the GUI is NOT reloaded and NOT restarted (D) any extension is added. To see the bug under normal circumstances, the config needs to be applied (E).

The issue: The issue is that the aiSwapper entries in the user config that have not been set in the custom menu are set as undefined. The merge logic of UI-defined values, then config-defined values, then user-defined values expected undefined entries to be missing. Instead, any aiSwapper entries of the UI-defined and config-defined are overridden by undefined, except the ones that were user-defined (customisations). Since YAML filters out undefined stuff (or I wrote that in at some point), the output file doesn't list the bunch of undefined stuff. I did see those in the dev console as displayed here by Krarilotus: ⁠ucp3-testing⁠Big Bug: Extensions just won't…

Avoiding the issue: The issue can be avoided by reloading or refreshing the GUI after the custom menu had been opened (and config applied). Since the config is loaded from disk, and the undefined aren't present there, there is no issue.

https://discord.com/channels/426318193603117057/1230981973028110336/1234947613997138103