Home > Back-end >  Invariant Violation: 29 on react apollo grapql
Invariant Violation: 29 on react apollo grapql

Time:02-18

What does this error mean? Invariant Violation: 29 (see https://github.com/apollographql/invariant-packages) did I miss something on my code that trigger this error? does anyone knows what does this error mean?, I've encounter this error when i tried to import the LocationSearch component to my index.js

import { LocationSearch } from '../component/LocationSearch';

<LocationSearch
   freeSolo
   withIcon={false}
/>

../component/LocationSearch.js

import { GETSTUDENTLOCATION } from '../../utils/location.gql';
const propTypes = {
   withIcon: PropTypes.bool,
}
const defaultProps = {
   withIcon: true,
}
const LocationSearch = ({
   withIcon,
})=>{
  const [getStudentLocations] = useQuery(GETSTUDENTLOCATION);

  const onChangeHandler = (e, value) => {
    onChange(value);
    const { valid, error } = isValid(value);
    if (!valid) {
      one rror(error, value);
    }

    setOpen(false);
    setOptions([]);
  };

  const onInputChangeHandler = (e, inputString, reason) => {
      setKeyUpTimeOut(
        setTimeout(async () => {
          setLoading(true);
          const { data: searchLocation } = await getLocations({
            variables: {
              placeSearch: {
                address: inputString,
              },
            },
          });
          setLoading(false);
          setOptions(searchLocation.findLocationByAddress || []);
          setOpen(true);
        }, 500)
      );
  };


<Autocomplete
    onChange={onChangeHandler}
    onClose={onClose}
    onInputChange={onInputChangeHandler}
    open={open}
    options={uniqBy(
       multiple
       ? [...options, ...value]
       : value
       ? [...options, value]
       : options,
       'name'
    )}
/>
}

../../utils/location.gql

export const GETSTUDENTLOCATION = gql`
  query SearchStudentLocation($placeSearch: Location!) {
    searchstudentlocation(placeSearch: $placeSearch) {
      student_name
      address {
        street1
        street2
        city
        barangay
        houseNumber
        port
      }
      remarks
    }
  }
`;

CodePudding user response:

I think its because of the version of your apollo-client

  • Related