Skip to content

Fix re-entrancy and redundant saves in profile rename handlers#2

Merged
hu-ja-ja merged 3 commits intodevfrom
copilot/sub-pr-1
Feb 11, 2026
Merged

Fix re-entrancy and redundant saves in profile rename handlers#2
hu-ja-ja merged 3 commits intodevfrom
copilot/sub-pr-1

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

Addresses code review feedback on PR #1 (profile rename feature): eliminates PropertyChanged re-entrancy loops, removes redundant I/O, and improves migration robustness.

Changes

Re-entrancy prevention in OnProfileNameChanged

  • Added _isUpdatingProfileName guard flag to prevent infinite loops when programmatically reverting or adjusting profile names
  • Added early exit when name hasn't changed vs. store

Optimized RenameProfile I/O

  • Skip file write and timestamp update when resolved name equals current name
  • Trim input before uniqueness resolution

Robust migration detection in ProfileStore.Load

  • Replaced string-based JSON search with object-level duplicate/missing ID detection before normalization
  • Handles minified JSON and formatting variations correctly

Cleanup consistency in SyncManager

  • Clear _profileNames alongside _syncGroups when sync is disabled

Test hygiene

  • Log warnings on test directory cleanup failure instead of silent catch
// Before: setting pi.Name triggers PropertyChanged recursively
pi.Name = finalName;  // Re-enters OnProfileNameChanged

// After: guarded assignment prevents re-entrancy
_isUpdatingProfileName = true;
try { pi.Name = finalName; }
finally { _isUpdatingProfileName = false; }

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 11, 2026 13:26
…, optimize saves

Co-authored-by: hu-ja-ja <107774991+hu-ja-ja@users.noreply.github.com>
Co-authored-by: hu-ja-ja <107774991+hu-ja-ja@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ability to rename profile names Fix re-entrancy and redundant saves in profile rename handlers Feb 11, 2026
Copilot AI requested a review from hu-ja-ja February 11, 2026 13:29
@hu-ja-ja hu-ja-ja marked this pull request as ready for review February 11, 2026 13:32
@hu-ja-ja hu-ja-ja merged commit 295a478 into dev Feb 11, 2026
@hu-ja-ja hu-ja-ja deleted the copilot/sub-pr-1 branch February 14, 2026 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants