File tree 1 file changed +10
-2
lines changed
plugins/lime-plugin-mesh-wide/src/components/FeatureDetail
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
import { Trans } from "@lingui/macro" ;
2
- import { useState } from "preact/hooks" ;
2
+ import { useEffect , useState } from "preact/hooks" ;
3
3
import { useCallback } from "react" ;
4
4
5
5
import { Button } from "components/buttons/button" ;
@@ -23,7 +23,7 @@ const UpdateNodeInfoBtn = ({ node }: { node: INodeInfo }) => {
23
23
const ip = node . ipv4 ;
24
24
25
25
const [ isLoading , setIsLoading ] = useState ( false ) ;
26
- const { showToast } = useToast ( ) ;
26
+ const { showToast, hideToast } = useToast ( ) ;
27
27
28
28
const { mutateAsync : localNodeSync } = useSyncDataTypes ( {
29
29
ip,
@@ -76,6 +76,14 @@ const UpdateNodeInfoBtn = ({ node }: { node: INodeInfo }) => {
76
76
showToast ,
77
77
] ) ;
78
78
79
+ // Use effect to sync the node data on mount
80
+ useEffect ( ( ) => {
81
+ ( async ( ) => {
82
+ await syncNode ( ) ;
83
+ } ) ( ) ;
84
+ // eslint-disable-next-line react-hooks/exhaustive-deps
85
+ } , [ node . ipv4 ] ) ;
86
+
79
87
return (
80
88
< Button
81
89
color = { "primary" }
You can’t perform that action at this time.
0 commit comments