facebook / relay

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

MockPayloadGenerator.generateWithDefer returns incorrect `path` for deferred data for list items. #4676

Closed jakobkhansen closed 1 month ago

jakobkhansen commented 2 months ago

Hi,

I am seeing an issue when using MockPayloadGenerator.generateWithDefer to generate deferred data in list items. This happens because the path returned in the responses does not contain the index of the list-item.

Example:

A response returns

["x", "y", "z", "edges", "node"]

which should be

["x", "y", "z", "edges", 0, "node"]

Without this, the deferred data is not correctly read into the relay store and list items don't get deferred data.

Tagging @gorodscy as it seems you implemented generating deferred data in Relay quite recently.

gorodscy commented 1 month ago

@jakobkhansen Thanks for flagging this bug! I fixed it in this commit. Let me know if you still encounter issues.

jakobkhansen commented 1 month ago

Thanks! I will test this out when we can bump our project, closing for now 😄