fix(scripts): Avoid adding duplicate scripts

This commit is contained in:
Michael Aaron Murphy 2021-08-20 23:07:40 +02:00
parent a87686a94f
commit 454ce19f08

View file

@ -93,8 +93,13 @@ impl App {
}; };
let script_receiver = async { let script_receiver = async {
while let Some(script) = rx.recv().await { 'outer: while let Some(script) = rx.recv().await {
tracing::debug!("appending script: {:?}", script); tracing::debug!("appending script: {:?}", script);
for cached_script in &self.scripts {
if cached_script.name == script.name {
continue 'outer;
}
}
self.scripts.push(script); self.scripts.push(script);
} }
}; };