Persist tracking settings as defaults; seed on new pack load#89
Closed
emosaru wants to merge 1 commit into
Closed
Conversation
…(issue #83) When the user toggles a tracking setting via the UI (which binds directly to SessionSettings), the change now propagates back to ApplicationSettings' seed fields and writes to application_settings.json — so the preference survives restart and becomes the default for future sessions. When a new pack/variant is activated, SessionSettings is seeded from the saved defaults before init.lua executes, so pack scripts start from the user's preferences and may optionally override them. Reloading the same pack leaves the current settings unchanged (no seed reset). Pack-script-driven changes (i.e. those made while PackageLoader.IsLoading is true) are suppressed from writing the seeds, so init.lua cannot accidentally overwrite the user's saved preferences. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
emosaru
commented
May 10, 2026
| /// suppress seed-writes driven by pack-script (init.lua) changes, | ||
| /// so only explicit user UI changes update the saved defaults. | ||
| /// </summary> | ||
| internal static bool IsLoading => mInProgress; |
Contributor
Author
There was a problem hiding this comment.
This appears unused. If it is, it should be removed.
Contributor
Author
There was a problem hiding this comment.
It is used — ApplicationSettings.SyncSeedsFromSession checks it at line 119 (if (Sessions.PackageLoader.IsLoading) return;). Easy to miss since it's a cross-file internal reference. Happy to leave as-is.
Contributor
Author
|
Closing for further design work before merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #83.
Summary
Persist UI changes: When the user toggles a tracking setting (Ignore All Logic, Show All Locations, Always Allow Clearing, Auto-unpin on Clear, Pin on Item Capture) via the menu, the change now propagates back to
ApplicationSettings' seed fields and writes toapplication_settings.json. Previously, UI bindings went directly toSessionSettingsbypassing the seed, so preferences were lost on restart.Seed on new pack/variant load:
ActivatePackagenow callsSeedIntoSessionbeforePackageLoader.LoadInto, so the state's settings are reset to the user's saved defaults beforeinit.luaruns. Pack scripts can still override them during initialization.Guard against init.lua overwriting seeds:
SyncSeedsFromSessionno-ops whenPackageLoader.IsLoadingis true, so pack-script-driven setting changes don't clobber the user's saved preferences.Reload is unchanged:
Reload()does not seed — reloading the same pack preserves the current session settings.Changes
PackageLoader.csinternal static bool IsLoading(exposes the existing[ThreadStatic] mInProgressflag)ApplicationSettings.csSyncSeedsFromSession: updates seed fields + writes JSON, guarded byIsLoadingSessionSettings.cs[OnChanged(SyncSeedsToApplicationSettings)]to the 4 settings without hooks;OnIgnoreAllLogicChangedalso calls the sync methodTrackerState.PackageOps.csActivatePackagecallsSeedIntoSession(Settings)beforeLoadIntoTest plan
🤖 Generated with Claude Code