Skip to content

Commit 8e3fce2

Browse files
committed
Add memo
1 parent 621306c commit 8e3fce2

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

frontend/src/old-pages/Clusters/Actions.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
1010
// limitations under the License.
1111
import {ClusterStatus} from '../../types/clusters'
12-
import React from 'react'
12+
import React, {useMemo} from 'react'
1313
import {useNavigate} from 'react-router-dom'
1414

1515
import {setState, useState, ssmPolicy, consoleDomain} from '../../store'
@@ -45,7 +45,10 @@ export default function Actions() {
4545

4646
const apiVersion = useState(['app', 'version', 'full'])
4747
const clusterVersion = useState([...clusterPath, 'version'])
48-
const versionSupported = apiVersion.includes(clusterVersion)
48+
const versionSupported = useMemo(() =>
49+
apiVersion.includes(clusterVersion),
50+
[apiVersion, clusterVersion]
51+
);
4952

5053
const fleetStatus = useState([...clusterPath, 'computeFleetStatus'])
5154
const clusterStatus = useState([...clusterPath, 'clusterStatus'])
@@ -74,9 +77,9 @@ export default function Actions() {
7477
const isEditDisabled =
7578
clusterStatus === ClusterStatus.CreateInProgress ||
7679
clusterStatus === ClusterStatus.DeleteInProgress ||
77-
clusterStatus === ClusterStatus.UpdateInProgress
78-
// clusterStatus === ClusterStatus.CreateFailed ||
79-
// !versionSupported
80+
clusterStatus === ClusterStatus.UpdateInProgress ||
81+
clusterStatus === ClusterStatus.CreateFailed ||
82+
!versionSupported
8083
const isStartFleetDisabled = fleetStatus !== 'STOPPED'
8184
const isStopFleetDisabled = fleetStatus !== 'RUNNING'
8285
const isDeleteDisabled =

0 commit comments

Comments
 (0)