facebook / relay

Relay is a JavaScript framework for building data-driven React applications.
https://relay.dev
MIT License
18.38k stars 1.82k forks source link

Attempt to avoid cycled when expanding updated ids to include impacted resolvers #4792

Closed captbaritone closed 2 weeks ago

captbaritone commented 2 weeks ago

We have seen a bug internally which appears to be a case where we encounter a cycle in this code and thus an infinite loop. I have yet to figure out how to reproduce that behavior, but it's clear that there is a bug in this code. We maintain a set of visited IDs but then never check that set as you progress.

For now I'm adding what I believe to be a more correct implementation, however I haven't yet been able to reproduce so I'm not 100% sure this will actually fix the issue. Additionally, it's in a sensitive part of the code, so I'm gating it to allow for a gradual rollout and the ability to quickly disable.

Test Plan

I've ensured the relevant tests validate both paths. During rollout I'll also create Diffs to run e2e tests with the fix enabled.

facebook-github-bot commented 2 weeks ago

@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot commented 2 weeks ago

@captbaritone merged this pull request in facebook/relay@f9365f763079f997693d2f8286e86556ead949b7.