Is apollo/client: "3.2.20" compatible with React 18?

I have a Next.js application running on React 17 and my goal is to upgrade to React 18. However, I’ve been facing issues while trying to upgrade the @apollo/client package to the latest version. I’ve made two failed attempts so far:

  1. I tried upgrading from @apollo/client: 3.3.20 to @apollo/client: 3.6.0. This caused one of our pages to fail due to server-side rendering (SSR) issues. We were able to resolve it, but then we noticed that one of our unit tests was consistently failing. So, we decided to try a different version.

  2. We then attempted to upgrade from @apollo/client: 3.3.20 to @apollo/client: 3.7.15. This version fixed the failing unit test, and we were able to merge it and deploy it to production. However, after a couple of days, we noticed a significant increase in CPU utilization and memory usage, indicating a memory leak. We had to revert the upgrade, and the ECS health metrics returned to normal.

Our main goal is to upgrade to React 18, but we keep running into issues with @apollo/client versions above 3.6.0. We are wondering if it’s sufficient to stay on version 3.3.20 for React 18 or if it will cause problems in the future?

Also what can cause this memory leak when upgrading from apollo/client: 3.3.20 → 3.7.15?

Without a reproduction and information how you create & save those clients, we can’t really say anything about that memory issue you are having.

Generally, the last minor release on 3.2 (there is no 3.2.20) was back in November 2020, with React 18 being released in 2022. They might work together, but there is no guarantee. The first version of Apollo Client to officially support React 18 is 3.6.