I’ve got a React useRef that I use to store my appointments when they come in from a useQuery:
Appts.current = ((data) && (data.Appts) ? data.Appts : []);
I also have a useSubscription that adds the incoming appointment to the useRef and sorts the list:
Appts.current.push(newAPPT);
Appts.current = Appts.current.sort(sortApptsByDateHelper);
This has worked fine for years. I updated to the latest libraries, and now Appts.current.push(newAPPT)
is throwing this error:
Uncaught TypeError: Cannot add property 8, object is not extensible
at Array.push ()
I’m looking at the docs for useSubscription, and I don’t yet see how to handle this.
What are the best practices now for this kind of situation?