Skip to content

useFragment is not scalable as the number of fragment grows #11514

Open
@hanlindev

Description

Issue Description

In our organization, we are planning to encourage the use of fragments among individual teams so they can independently manage their own data requirements without affecting the main host app or other teams.

However, we discovered that the number of fragments has a significant impact on the site speed, specifically time-to-interactive. Through performance profiling, we are pretty certain that it is caused by two factors:

  • The identify function to obtain the cache ID (our GraphQL types have non-ID primary key fields)
  • The in memory cache’s diffQueryAgainstStore function.

We created a sample app to help reproduce the issue. Please refer to the Link to Reproduction.

The question was originally posted on the community forum, creating this issue so the Apollo team can track this.

Link to Reproduction

https://github.com/jashmoreindeed/apollo-client-performance

Reproduction Steps

See the README for the apollo-client-performance repo.

@apollo/client version

3.8.10

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions