From 825e04ea2ba0ec9011374ad78a5f17f28a66bd53 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Wed, 11 Dec 2024 16:35:36 +0200 Subject: [PATCH] app_store UI: reload our_apps after publishing a new one --- .../app_store/ui/src/pages/PublishPage.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx index 285aa537..91213d3e 100644 --- a/kinode/packages/app_store/ui/src/pages/PublishPage.tsx +++ b/kinode/packages/app_store/ui/src/pages/PublishPage.tsx @@ -41,6 +41,18 @@ export default function PublishPage() { } }, [packageName, publisherId, fetchDownloadsForApp]); + useEffect(() => { + if (isConfirmed) { + // Fetch our apps again after successful publish + fetchOurApps(); + // Reset form fields + setPackageName(""); + setPublisherId(window.our?.node || ""); + setMetadataUrl(""); + setMetadataHash(""); + } + }, [isConfirmed, fetchOurApps]); + const validatePackageName = useCallback((name: string) => { // Allow lowercase letters, numbers, hyphens, and dots const validNameRegex = /^[a-z0-9.-]+$/; @@ -173,12 +185,6 @@ export default function PublishPage() { gas: BigInt(1000000), }); - // Reset form fields - setPackageName(""); - setPublisherId(window.our?.node || ""); - setMetadataUrl(""); - setMetadataHash(""); - } catch (error) { console.error(error); }