File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
resources/scripts/components/server/network Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import Can from '@/components/elements/Can';
1111import SpinnerOverlay from '@/components/elements/SpinnerOverlay' ;
1212import getServerAllocations from '@/api/swr/getServerAllocations' ;
1313import isEqual from 'react-fast-compare' ;
14+ import { useDeepCompareEffect } from '@/plugins/useDeepCompareEffect' ;
1415
1516const NetworkContainer = ( ) => {
1617 const [ loading , setLoading ] = useState ( false ) ;
@@ -23,7 +24,7 @@ const NetworkContainer = () => {
2324 const { data, error, mutate } = getServerAllocations ( ) ;
2425
2526 useEffect ( ( ) => {
26- mutate ( allocations , false ) ;
27+ mutate ( allocations ) ;
2728 } , [ ] ) ;
2829
2930 useEffect ( ( ) => {
@@ -32,6 +33,12 @@ const NetworkContainer = () => {
3233 }
3334 } , [ error ] ) ;
3435
36+ useDeepCompareEffect ( ( ) => {
37+ if ( ! data ) return ;
38+
39+ setServerFromState ( state => ( { ...state , allocations : data } ) ) ;
40+ } , [ data ] ) ;
41+
3542 const onCreateAllocation = ( ) => {
3643 clearFlashes ( 'server:network' ) ;
3744
You can’t perform that action at this time.
0 commit comments