fix(rigs): refresh stale starters on update; tab follows current rig
- Seeding now (re)installs every starter by stable id, so a corrected rig definition replaces the stale copy already in a library (save upserts by id, keeping its position) — user rigs untouched. Bumped seedVersion to 2 so existing libraries pick up the two-board Garcia rig (the old router version showed "No board at index 0" because the builder UI renders boards, not routers, and the stale entry was never refreshed). "Restore Starter Rigs" likewise refreshes all starters, not just missing ones. - The Mine/Starters toggle now opens on the group containing the currently loaded rig (Starters when a factory rig like Garcia is active, else Mine), and follows the selection when the current rig changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -77,6 +77,18 @@ struct RigLibrarySidebarView: View {
|
||||
actionBar
|
||||
}
|
||||
.frame(width: RigLibrarySidebarView.width)
|
||||
// Open on the tab that contains the currently-loaded rig, so a session restored on a starter
|
||||
// rig (e.g. Garcia) shows Starters, and one on a user rig shows Mine.
|
||||
.onAppear { tab = tabForCurrentRig() }
|
||||
.onChange(of: currentRigID) { tab = tabForCurrentRig() }
|
||||
}
|
||||
|
||||
/// The tab whose group contains the currently-loaded rig: Starters for a factory rig, else Mine.
|
||||
private func tabForCurrentRig() -> RigTab {
|
||||
if let id: UUID = currentRigID, FactoryRigLibrary.isFactory(id) {
|
||||
return .starters
|
||||
}
|
||||
return .mine
|
||||
}
|
||||
|
||||
// MARK: - Header
|
||||
|
||||
Reference in New Issue
Block a user