bito-code-review[bot] commented on code in PR #38958:
URL: https://github.com/apache/superset/pull/38958#discussion_r3015494494


##########
superset-frontend/src/chartCustomizations/components/DeckglLayerVisibility/useDeckLayerMetadata.ts:
##########
@@ -35,7 +35,7 @@ export const useDeckLayerMetadata = (
   error: string | null;
 } => {
   const [layers, setLayers] = useState<LayerInfo[]>([]);
-  const [isLoading, setIsLoading] = useState(false);
+  const [isLoading, setIsLoading] = useState(sliceIds.length > 0);

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Loading state not reset on empty sliceIds</b></div>
   <div id="fix">
   
   While initializing isLoading based on sliceIds.length > 0 correctly sets the 
initial state, the useEffect does not reset isLoading to false when sliceIds 
becomes empty, potentially leaving the loading indicator active when no loading 
is occurring.
   </div>
   
   
   <details>
   <summary>
   <b>Code suggestion</b>
   </summary>
   <blockquote>Check the AI-generated fix before applying</blockquote>
   <div id="code">
   
   
   ```
    -    if (!sliceIds || sliceIds.length === 0) {
    -      setLayers([]);
    -      return;
    +    if (!sliceIds || sliceIds.length === 0) {
    +      setLayers([]);
    +      setIsLoading(false);
    +      return;
   ```
   
   </div>
   </details>
   
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #612554</i></small>
   </div>
   
   ---
   Should Bito avoid suggestions like this for future reviews? (<a 
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
   - [ ] Yes, avoid them



-- 
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