Skip to content

Commit 07b253e

Browse files
Fix profile not being selected on first startup
1 parent bc63e55 commit 07b253e

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
66

77
## [Unreleased] - ReleaseDate
88

9+
### Fixed
10+
11+
- Fix profile not being selected on initial startup
12+
913
## [1.2.0] - 2024-05-10
1014

1115
### Added

src/collection/models.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,11 @@ pub enum ChainOutputTrim {
308308
}
309309

310310
impl Profile {
311+
/// For combinators
312+
pub fn id(&self) -> &ProfileId {
313+
&self.id
314+
}
315+
311316
/// Get a presentable name for this profile
312317
pub fn name(&self) -> &str {
313318
self.name.as_deref().unwrap_or(&self.id)

src/tui/view/component/profile_select.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ pub struct ProfilePane {
4747

4848
impl ProfilePane {
4949
pub fn new(profiles: Vec<Profile>) -> Self {
50+
// If there's no selected profile in the DB, default to the first
51+
let selected_profile = profiles.first().map(Profile::id).cloned();
5052
Self {
5153
profiles,
5254
selected_profile: Persistent::new(
5355
PersistentKey::ProfileId,
54-
Default::default(),
56+
selected_profile.into(),
5557
),
5658
}
5759
}

static/demo.gif

Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)