removed useEffect and used skip (works)

This commit is contained in:
Irtiza-h30
2020-08-15 10:27:27 -04:00
parent 5854c1a0a0
commit 3affd7b6a6

View File

@@ -1,8 +1,8 @@
import React, { useContext, useEffect } from 'react'; import React, { useContext } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import gql from 'graphql-tag'; import gql from 'graphql-tag';
import { useQuery, useMutation, useLazyQuery } from '@apollo/react-hooks'; import { useQuery, useMutation } from '@apollo/react-hooks';
import { Alert, notification } from 'antd'; import { Alert, notification } from 'antd';
import moment from 'moment'; import moment from 'moment';
import { import {
@@ -154,14 +154,13 @@ const AccessPointDetails = ({ locations }) => {
}, },
}); });
const [ const { data: dataFirmware, error: errorFirmware, loading: loadingFirmware } = useQuery(
getAllFirmware, GET_ALL_FIRMWARE,
{ data: dataFirmware, error: errorFirmware, loading: loadingFirmware }, {
] = useLazyQuery(GET_ALL_FIRMWARE); skip: !data?.getEquipment?.model,
variables: { modelId: data?.getEquipment?.model.toLowerCase() },
useEffect(() => { }
getAllFirmware({ variables: { modelId: data?.getEquipment?.model?.toLowerCase() } }); );
}, [data]);
const { data: dataProfiles, error: errorProfiles, loading: loadingProfiles } = useQuery( const { data: dataProfiles, error: errorProfiles, loading: loadingProfiles } = useQuery(
GET_ALL_PROFILES, GET_ALL_PROFILES,