Sort ids by entity property in redux store
<p>I have a problem sorting the data in my redux-store.</p>

<p>My store looks like this:</p>

<pre><code>state = {
  ids: [1,2,3,4, /*...*/],
  entities: {
    1: {
      id: 1,
      time: 50
    }
    //...
  }
};
</code></pre>

<p>In my reducer function I want to sort the ids, in this way my data will always be sorted and ready to use, without needing to sort it every time:</p>

<pre><code>case LOAD_LIST_SUCCESS:
  return Object.assign({}, state,
    {ids: [state.ids, ...action.payload.normalized.result].sort()}, //Here is my problem...
    {entities: [...state.entities, ...action.payload.normalized.entities.items});
</code></pre>

<p>How can I sort the ids array by the entities time property?</p>