uptrend-tech / uptrend-redux-modules

Collection of modules useful to redux based react apps.
MIT License
5 stars 1 forks source link

EntityList helper component returns every entity if entityIds undefined #63

Open orther opened 5 years ago

orther commented 5 years ago

Bug Report

Current Behavior Passing undefined to entityIds prop of the EntityList helper component returns all entities for that type. This behavior resulted in app crashing in glorious fashion when every component was passed 1500 entities to render.

Input Code

<EntityList entityIds={undefined} entityType="worksheetQuestion">
  {questionList => {
    // !!!
    // !!! questionList is array of every entity detail in redux store state `entities.worksheetQuestion`
    // !!!
  }}
</<EntityList>

Expected behavior/code It should return 0 results and possibly warn in dev console?

Environment

Possible Solution

Update the EntityList component to short circuit if entityIds is not pass array.

orther commented 5 years ago

After review the current implementation returns all entities when entittIds is not set (undefined). This behavior should be removed and a boolean prop flag returnAllEntities added to return all entities.