Added minor changes for BOD-83 scheduling load.

This commit is contained in:
Patrick Fic
2020-05-11 10:03:56 -07:00
parent 0c93488c1f
commit 3af8b28764
4 changed files with 20 additions and 22 deletions

View File

@@ -1,6 +1,6 @@
import { useQuery } from "@apollo/react-hooks";
import queryString from "query-string";
import React from "react";
import React, { useMemo } from "react";
import { useLocation } from "react-router-dom";
import { QUERY_ALL_ACTIVE_APPOINTMENTS } from "../../graphql/appointments.queries";
import AlertComponent from "../alert/alert.component";
@@ -21,7 +21,7 @@ export function ScheduleCalendarContainer({ calculateScheduleLoad }) {
const search = queryString.parse(useLocation().search);
const { date, view } = search;
const range = getRange(date, view);
const range = useMemo(() => getRange(date, view), [date, view]);
const { loading, error, data, refetch } = useQuery(
QUERY_ALL_ACTIVE_APPOINTMENTS,
{
@@ -31,7 +31,7 @@ export function ScheduleCalendarContainer({ calculateScheduleLoad }) {
);
if (loading) return <LoadingSpinner />;
if (error) return <AlertComponent message={error.message} type='error' />;
if (error) return <AlertComponent message={error.message} type="error" />;
let normalizedData = data.appointments.map((e) => {
//Required becuase Hasura returns a string instead of a date object.
return Object.assign(