title: How to get the latest value from the server?
body: <p>The function receives a value from the server and, if it matches, writes data to the array. In this case, the ticket.id first receives the value undefined and then the data. But the function does not have time to get the second value, and writes undefined to the array. How can you avoid this?</p>
  <pre><code> const rules = (state) =&gt; {
      const user = state.user;
      const ticket = state.ticket;
      const relatedUsers = state.models[name].currentTicket.relatedUsers || [];
      const role = [];
  
  
      related.map(item =&gt; item.id === user.id &amp;&amp; role.push(item.rule));
  
      user.Id === ticket.id ? role.push(4) : undefined;
  
      return role;
  };
  </code></pre>