bito-code-review[bot] commented on PR #42153:
URL: https://github.com/apache/superset/pull/42153#issuecomment-5146296049
<!-- Bito Reply -->
The flagged issue is correct. `Locator.wait_for()` only ensures the element
is present in the DOM, not that the chart content inside it has finished
rendering. Incrementing `rendered_chart_count` based on this check can lead to
misleading logs if the chart is still loading (e.g., showing a spinner).
To resolve this, you should either rename the variable to reflect that it
counts located containers, or implement a more robust readiness check (e.g.,
waiting for a specific class or state that indicates the chart has finished
rendering). Given the current implementation, renaming the variable is the most
straightforward fix.
Would you like me to fetch all other comments on this PR to validate and
implement fixes for them as well?
**superset/utils/webdriver.py**
```
slice_container_elems: list[Locator] = []
located_chart_count = 0
try:
# chart containers didn't render
logger.debug("Wait for chart containers to draw at url:
%s", url)
slice_container_locator =
page.locator(".chart-container")
# One-time snapshot: containers mounting after this point
# are neither waited on nor counted, so the progress
# numbers below describe the snapshot, not the final DOM.
slice_container_elems = slice_container_locator.all()
for slice_container_elem in slice_container_elems:
slice_container_elem.wait_for()
located_chart_count += 1
except PlaywrightTimeout:
# Customer-side chart loading is often just slow, not a
# Superset bug, so this is a WARNING (matching the other
# locate-wait timeouts below) rather than an ERROR -- but
# it still fails the screenshot; see the `raise` below.
logger.warning(
"Timed out waiting for chart containers to draw at
url %s "
"(%s of %s chart containers located before the
timeout)",
url,
located_chart_count,
len(slice_container_elems),
exc_info=True,
)
```
--
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]