Skip to content

Commit

Permalink
fix launch button bug
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-frmr committed Jan 15, 2025
1 parent 875c440 commit 8e1e6b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
10 changes: 2 additions & 8 deletions kinode/packages/app-store/app-store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,7 @@ fn handle_local_request(
(
match utils::uninstall(our, state, &process_lib_package_id) {
Ok(()) => {
println!(
"successfully uninstalled package {}",
&process_lib_package_id
);
println!("successfully uninstalled package {process_lib_package_id}");
// TODO handle?
let _ = Request::to(("our", "chain", "app-store", "sys"))
.body(
Expand All @@ -345,10 +342,7 @@ fn handle_local_request(
LocalResponse::UninstallResponse(UninstallResponse::Success)
}
Err(e) => {
println!(
"error uninstalling package {}: {e}",
&process_lib_package_id
);
println!("error uninstalling package {process_lib_package_id}: {e}");
LocalResponse::UninstallResponse(UninstallResponse::Failure)
}
},
Expand Down
11 changes: 6 additions & 5 deletions kinode/packages/app-store/ui/src/pages/AppPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default function AppPage() {
const [showCapApproval, setShowCapApproval] = useState(false);
const [manifestResponse, setManifestResponse] = useState<ManifestResponse | null>(null);
const [isPolling, setIsPolling] = useState(false);
const [canLaunch, setCanLaunch] = useState(false);

const appDownloads = useMemo(() => downloads[id || ""] || [], [downloads, id]);

Expand Down Expand Up @@ -98,6 +99,11 @@ export default function AppPage() {
setApp(appData);
setInstalledApp(installedAppData);

if (appData) {
await fetchHomepageApps();
setCanLaunch(!!getLaunchUrl(`${appData.package_id.package_name}:${appData.package_id.publisher_node}`));
}

if (appData?.metadata?.properties?.code_hashes) {
const versions = appData.metadata.properties.code_hashes;
if (versions.length > 0) {
Expand Down Expand Up @@ -216,11 +222,6 @@ export default function AppPage() {
}
}, [app, getLaunchUrl]);

const canLaunch = useMemo(() => {
if (!app) return false;
return !!getLaunchUrl(`${app.package_id.package_name}:${app.package_id.publisher_node}`);
}, [app, getLaunchUrl]);

const handleUninstall = async () => {
if (!app) return;
setIsUninstalling(true);
Expand Down

0 comments on commit 8e1e6b3

Please sign in to comment.