Skip to content

Commit 51070b2

Browse files
committed
Make sure loading bar in model selector is visible on start up
1 parent 454f109 commit 51070b2

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/chat/model_selector.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ live_design! {
3737
loading = <ModelSelectorLoading> {
3838
width: Fill,
3939
height: Fill,
40-
visible: false,
4140
}
4241

4342
choose = <View> {
@@ -315,7 +314,7 @@ impl ModelSelector {
315314
self.model_selector_loading(id!(loading))
316315
.show_and_animate(cx);
317316
} else {
318-
self.model_selector_loading(id!(loading)).hide(cx);
317+
self.model_selector_loading(id!(loading)).hide();
319318
}
320319
}
321320

@@ -358,7 +357,6 @@ impl ModelSelector {
358357
let size = format_model_size(&downloaded_file.file.size).unwrap_or("".to_string());
359358
let size_visible = !size.trim().is_empty();
360359

361-
self.model_selector_loading(id!(loading)).hide(cx);
362360
self.view(id!(selected)).apply_over(
363361
cx,
364362
live! {

src/chat/model_selector_loading.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,13 @@ impl Widget for ModelSelectorLoading {
101101

102102
impl ModelSelectorLoading {
103103
pub fn update_animation(&mut self, cx: &mut Cx) {
104+
self.visible = true;
104105
if self.animator_in_state(cx, id!(line.restart)) {
105-
self.visible = true;
106106
self.animator_play(cx, id!(line.run));
107-
self.timer = cx.start_timeout(1.5);
108107
} else {
109-
self.visible = true;
110108
self.animator_play(cx, id!(line.restart));
111-
self.timer = cx.start_timeout(1.5);
112109
}
110+
self.timer = cx.start_timeout(1.5);
113111
}
114112
}
115113

@@ -123,11 +121,11 @@ impl ModelSelectorLoadingRef {
123121
}
124122
}
125123

126-
pub fn hide(&mut self, cx: &mut Cx) {
124+
pub fn hide(&mut self) {
127125
let Some(mut inner) = self.borrow_mut() else {
128126
return;
129127
};
130-
inner.view.visible = false;
128+
inner.visible = false;
131129
inner.timer = Timer::default();
132130
}
133131
}

0 commit comments

Comments
 (0)