diff --git a/plugins/lime-plugin-mesh-wide/src/components/FeatureDetail/UpdateNodeInfoBtn.tsx b/plugins/lime-plugin-mesh-wide/src/components/FeatureDetail/UpdateNodeInfoBtn.tsx index 2c3d9137..b8a8b9db 100644 --- a/plugins/lime-plugin-mesh-wide/src/components/FeatureDetail/UpdateNodeInfoBtn.tsx +++ b/plugins/lime-plugin-mesh-wide/src/components/FeatureDetail/UpdateNodeInfoBtn.tsx @@ -1,5 +1,5 @@ import { Trans } from "@lingui/macro"; -import { useState } from "preact/hooks"; +import { useEffect, useState } from "preact/hooks"; import { useCallback } from "react"; import { Button } from "components/buttons/button"; @@ -23,7 +23,7 @@ const UpdateNodeInfoBtn = ({ node }: { node: INodeInfo }) => { const ip = node.ipv4; const [isLoading, setIsLoading] = useState(false); - const { showToast } = useToast(); + const { showToast, hideToast } = useToast(); const { mutateAsync: localNodeSync } = useSyncDataTypes({ ip, @@ -76,6 +76,14 @@ const UpdateNodeInfoBtn = ({ node }: { node: INodeInfo }) => { showToast, ]); + // Use effect to sync the node data on mount + useEffect(() => { + (async () => { + await syncNode(); + })(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [node.ipv4]); + return (