How to get name property from client instance?

Hello, We have to use two different endpoints for one app and I need a way to distinguish each apollo client instance on some pages. I’ve looked up and found the name property in client instance can be a good option. but even though I set a name property when I initialize ApolloClient instance, when I get instance using useApolloClient() hooks, the instance doens’t have the name property. I wonder what I’m doing wrong here.
This is some part of my code.

// client.ts

export const testClient = new ApolloClient({
  name:"test app",
  uri: 'http://localhost:4000/graphql',
  cache: new InMemoryCache(),
});

// index.tsx

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <React.StrictMode>
    <ApolloProvider client={testClient}>
      <BrowserRouter>
        <App />
      </BrowserRouter>
    </ApolloProvider>
  </React.StrictMode>
);

// Post.tsx

const client = useApolloClient();
console.log(client) // This instance doens't have name property which I set above in client.ts

Did you try

export const testClient = new ApolloClient({
  uri: 'http://localhost:4000/graphql',
  cache: new InMemoryCache(),
});

testClient.name = "test app";

Don’t know if it will work if you put export before, if not try putting export after

const testClient = new ApolloClient({
  uri: 'http://localhost:4000/graphql',
  cache: new InMemoryCache(),
});

testClient.name = "test app";

export testClient;

Sadly it didn’t solve my problem but thank you for your reply :slight_smile:

You tried both way and it didn’t work?

I do the same thing but not using “name” and it works on my end, that is odd.