Skip to content

AutoShorts is a local-first desktop application for turning long-form video or audio recordings into high-impact, vertical short-form clip candidates (9:16 portrait) with AI-powered viral moment ranking.

Rust

refactor: update refresh function to accept optional project ID and conditionally fetch details

JayWebtech6238be8389f1
diff --git a/src/main.tsx b/src/main.tsx
index 40916bd..b0e1eea 100644
--- a/src/main.tsx
+++ b/src/main.tsx
@@ -141,7 +141,7 @@ function App() {
void refresh();
}, []);
- async function refresh(nextProjectId = detail?.project.id) {
+ async function refresh(nextProjectId?: string) {
setError(null);
const [env, projectList] = await Promise.all([
invoke<EnvironmentStatus>("environment_status"),
@@ -150,9 +150,8 @@ function App() {
setEnvironment(env);
setProjects(projectList);
- const projectId = nextProjectId ?? projectList[0]?.id;
- if (projectId) {
- const nextDetail = await invoke<ProjectDetail>("get_project_detail", { projectId });
+ if (nextProjectId) {
+ const nextDetail = await invoke<ProjectDetail>("get_project_detail", { projectId: nextProjectId });
setDetail(nextDetail);
} else {
setDetail(null);