Skip to content

useQuery not returning stable references #2701

@sarink

Description

@sarink

Describe the bug

I hope that I'm simply misunderstanding or have misconfigured something, but I can't seem to figure out why objects inside useQuery().data.MyQuery.someList[index] are changing references. This means they cannot be memoized, and the application rerenders unnecessarily

  • On initial load, the TodosList and every Todo renders three times
  • Upon creating or updating a todo, each individual Todo in the list rerenders

Thanks :)

For skimming (if you don't want to pull the repro repo):

Screen Shot 2022-09-23 at 4 05 03 PM

urql-memo

Reproduction

sarink/urql-perf#2

Urql version

^2.2.3

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions