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


##########
superset/utils/webdriver.py:
##########
@@ -301,7 +301,16 @@ def get_screenshot(  # pylint: disable=too-many-locals, 
too-many-statements  # n
                         "Wait for loading element of charts to be gone at url: 
%s", url
                     )
                     page.wait_for_function(
-                        "() => document.querySelectorAll('.loading').length 
=== 0",
+                        """() => {
+                            const els = document.querySelectorAll('.loading');
+                            for (const el of els) {
+                                const r = el.getBoundingClientRect();
+                                if (r.top < window.innerHeight && r.bottom > 
0) {
+                                    return false;
+                                }
+                            }
+                            return true;
+                        }""",

Review Comment:
   <div>
   
   
   <div id="suggestion">
   <div id="issue"><b>Semantic duplication in loading visibility logic</b></div>
   <div id="fix">
   
   The updated loading element visibility check logic duplicates the same 
JavaScript code already present in `take_tiled_screenshot` within 
`screenshot_utils.py`. This creates maintenance risk if the logic needs 
updates, as changes would need to be synced across both files. Consider 
refactoring to a shared utility.
   </div>
   
   
   </div>
   
   
   
   
   <small><i>Code Review Run #19541f</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