KirkMcDonald / kirkmcdonald.github.io

Simple web-based calculator for the game Factorio.
Apache License 2.0
550 stars 146 forks source link

Module settings are lost when an item is hidden #39

Closed super-aardvark closed 7 years ago

super-aardvark commented 7 years ago

When clicking on an item to ignore it, any components of that item, being removed from the list, lose their module settings. It would be nice if the module settings were retained when the ignored item is toggled back on.

For example:

  1. Calculate for Advanced Circuits.
  2. Set modules for Iron Plate production.
  3. Click to ignore Electronic Circuit.
  4. Click Electronic Circuit again to re-enable.

Result: Iron Plate no longer has modules set.

KirkMcDonald commented 7 years ago

Fixed in 82d537214a6d94c2903d803cacb24ec4aa4eebd8.

This was done semi-deliberately, in the function display.js:pruneSpec(), which deletes things from the set of configured modules when they belong to recipes that are no longer part of the solution. The intent of this function was to keep the URL fragment under control, so that it wouldn't save module configurations that were no longer relevant.

I have fixed this by pruning these elements in the process of formatting the fragment. This means that these module configurations will still be forgotten if you reload the page, but should at least be remembered while continuing to use the same instance of the page.