facebook / facebook/relay

[Modern] shouldComponentUpdate returns true for empty array props using @relay(plural: true)

Open
#1,975 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

When a fragment container specifies a prop as plural using `@relay(plural: true)`, `shouldComponentUpdate` incorrectly returns true (assuming no other props) if the prop had an empty array as its value both before and after the re-render. It works as intended if the array has at least one item (returns false if the items are the same before and after).

This can be circumvented by passing null instead of empty arrays as props, but it's not an ideal solution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.