@@ -2,7 +2,7 @@ import { ExclamationTriangleIcon } from "@heroicons/react/20/solid";
22import { json } from "@remix-run/node" ;
33import { useFetcher } from "@remix-run/react" ;
44import { motion } from "framer-motion" ;
5- import { useCallback , useEffect } from "react" ;
5+ import { useCallback , useEffect , useRef } from "react" ;
66import { LinkButton } from "~/components/primitives/Buttons" ;
77import { Paragraph } from "~/components/primitives/Paragraph" ;
88import { Popover , PopoverContent , PopoverTrigger } from "~/components/primitives/Popover" ;
@@ -26,12 +26,14 @@ export async function loader() {
2626export function IncidentStatusPanel ( { isCollapsed = false } : { isCollapsed ?: boolean } ) {
2727 const { isManagedCloud } = useFeatures ( ) ;
2828 const fetcher = useFetcher < typeof loader > ( ) ;
29+ const fetcherRef = useRef ( fetcher ) ;
30+ fetcherRef . current = fetcher ;
2931
3032 const fetchIncidents = useCallback ( ( ) => {
31- if ( fetcher . state === "idle" ) {
32- fetcher . load ( "/resources/incidents" ) ;
33+ if ( fetcherRef . current . state === "idle" ) {
34+ fetcherRef . current . load ( "/resources/incidents" ) ;
3335 }
34- } , [ fetcher ] ) ;
36+ } , [ ] ) ;
3537
3638 useEffect ( ( ) => {
3739 if ( ! isManagedCloud ) return ;
0 commit comments