ramiroaquinoromero commented on PR #37112:
URL: https://github.com/apache/superset/pull/37112#issuecomment-3804979975

   > Here's the actual review comment #33781 (comment). Can we check if this is 
not causing any rerenders?
   
   Good catch! I've optimized the selector implementation to prevent 
unnecessary rerenders.
   Current implementation (lines 189-208):
   ```
   const firstQueryResponse = useSelector<RootState, QueryData | undefined>(
     state => state.charts[slice.slice_id].queriesResponse?.[0],
   );
   
   const secondQueryResponse = useSelector<RootState, QueryData | undefined>(
     state => state.charts[slice.slice_id].queriesResponse?.[1],
   );
   ```
   Why this avoids rerenders:
   Each useSelector only subscribes to a specific query index ([0] or [1])
   Changes to unrelated queries won't trigger rerenders
   Only rerenders when the specific query response we're using actually changes
   This follows the same pattern from PR #33781 where you separated the 
selectors to avoid the array reference changing unnecessarily.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to