Skip to content

Commit d086819

Browse files
committed
Fix instance cards button id clash
1 parent 8dd5f64 commit d086819

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

crates/frontend/src/component/instance_list.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl InstanceList {
9191
Icon::default().path(icon_path).size_16().min_w_16().min_h_16().into_any_element()
9292
};
9393

94-
let play_button = render_play_button(item, self.backend_handle.clone());
94+
let play_button = render_play_button(item, index, self.backend_handle.clone());
9595

9696
let theme = cx.theme();
9797
v_flex()
@@ -169,7 +169,7 @@ impl TableDelegate for InstanceList {
169169
"name" => item.name.clone().into_any_element(),
170170
"version" => item.configuration.minecraft_version.as_str().into_any_element(),
171171
"controls" => {
172-
let play_button = render_play_button(item, self.backend_handle.clone());
172+
let play_button = render_play_button(item, row_ix, self.backend_handle.clone());
173173

174174
h_flex()
175175
.size_full()
@@ -194,12 +194,12 @@ impl TableDelegate for InstanceList {
194194
}
195195
}
196196

197-
fn render_play_button(item: &InstanceEntry, backend_handle: BackendHandle) -> Button {
197+
fn render_play_button(item: &InstanceEntry, index: usize, backend_handle: BackendHandle) -> Button {
198198
let name = item.name.clone();
199199
let id = item.id;
200200
match item.status {
201201
InstanceStatus::NotRunning => {
202-
Button::new("start_instance")
202+
Button::new(("start_instance", index))
203203
.success()
204204
.label(ts!("instance.start.label"))
205205
.on_click(
@@ -209,12 +209,12 @@ fn render_play_button(item: &InstanceEntry, backend_handle: BackendHandle) -> Bu
209209
)
210210
},
211211
InstanceStatus::Launching => {
212-
Button::new("launching")
212+
Button::new(("launching", index))
213213
.warning()
214214
.label("...")
215215
},
216216
InstanceStatus::Running => {
217-
Button::new("kill_instance")
217+
Button::new(("kill_instance", index))
218218
.danger()
219219
.label(ts!("instance.kill"))
220220
.on_click({

0 commit comments

Comments
 (0)