codeant-ai-for-open-source[bot] commented on code in PR #40238:
URL: https://github.com/apache/superset/pull/40238#discussion_r3264025457


##########
docs/admin_docs/configuration/dashboard-performance.mdx:
##########
@@ -0,0 +1,168 @@
+---
+title: Dashboard Performance
+hide_title: true
+sidebar_position: 5
+version: 1
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Dashboard Performance
+
+A dashboard's perceived speed is determined by three independent things: how
+many charts have to render, how many queries the backend can execute
+concurrently, and how quickly the underlying data warehouse can return
+results. Superset gives you levers for the first two; the third belongs to
+your warehouse. This page covers the dashboard-side levers and the practical
+guidance around them.
+
+## Is there a maximum chart count per dashboard?
+
+**No hard limit is enforced** — Superset has no configuration key that
+caps the number of charts on a dashboard. In practice, dashboards behave
+well up to a few dozen charts. Beyond that, you'll typically feel friction
+on the initial load and during cross-filter / time-range updates, even with
+the lazy-loading optimizations described below.
+
+Rough thresholds to keep in mind:
+
+- **Under ~25 charts**: usually no perceptible problem.
+- **25–50 charts**: still fine, but you start to want tabs to break the
+  page into chunks the user actually looks at.
+- **Over ~50 charts**: split into multiple dashboards or use tabs
+  aggressively. The bottleneck is rarely Superset itself — it's the
+  warehouse executing dozens of queries in parallel and the browser
+  rendering dozens of chart frames.
+
+These are guidelines, not guarantees. A dashboard of 100 sparkline-style
+charts hitting a fast cache behaves very differently from a dashboard of
+20 heavy aggregations against a cold warehouse.
+
+## Lazy rendering — `DASHBOARD_VIRTUALIZATION`
+
+Superset's dashboard layout is virtualized at the row level. Charts that
+are far below the user's current scroll position are not rendered (and
+therefore don't fetch data) until the user scrolls them into view, and they
+are unmounted again if scrolled well past. This is on by default.

Review Comment:
   **Suggestion:** The docs currently state that charts outside the viewport 
"don't fetch data" under `DASHBOARD_VIRTUALIZATION`, but in code the 
data-request deferral is controlled by the separate 
`DASHBOARD_VIRTUALIZATION_DEFER_DATA` flag (default `False`). This will mislead 
operators into expecting reduced backend query load from virtualization alone. 
Update this section to clarify that virtualization gates rendering, while 
off-screen query deferral depends on enabling the defer-data flag. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Operators may overestimate warehouse relief from virtualization alone.
   - ⚠️ Performance tuning decisions misaligned with actual Chart.tsx behavior.
   - ⚠️ Dashboard performance guide conflicts with feature-flags defaults 
documentation.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Open `docs/admin_docs/configuration/dashboard-performance.mdx` and locate 
the "Lazy
   rendering — `DASHBOARD_VIRTUALIZATION`" section at lines 58–63. Note the 
claim (lines
   60–63) that charts far below the scroll position "are not rendered (and 
therefore don't
   fetch data) until the user scrolls them into view".
   
   2. Inspect the row virtualization implementation in
   `superset-frontend/src/dashboard/components/gridComponents/Row/Row.tsx` 
lines 168–205. The
   IntersectionObservers toggle the `isInView` state when rows approach or 
leave the
   viewport, but the component still renders a `DashboardComponent` for each 
child (lines
   88–104) and passes `isInView` down; it does not unmount `ChartHolder` or 
`Chart` when the
   row is off-screen.
   
   3. Follow the prop chain into
   
`superset-frontend/src/dashboard/components/gridComponents/ChartHolder/ChartHolder.tsx`
   lines 92–113. `ChartHolder` always renders a `<Chart>` component and passes
   `isInView={isInView}` (line 111); there is no conditional that skips 
mounting `<Chart>`
   when `isInView` is false.
   
   4. Examine `superset-frontend/src/components/Chart/Chart.tsx`. 
`shouldRenderChart()`
   (lines 213–218) uses `isInView` and the `DashboardVirtualization` feature 
flag to decide
   whether to render `ChartRenderer` or a loading spinner (lines 68–87). 
However,
   `runQuery()` (lines 221–237) only defers the data request when
   `isFeatureEnabled(FeatureFlag.DashboardVirtualizationDeferData)` is true and
   `!this.shouldRenderChart()` (lines 221–225). With the default
   `DASHBOARD_VIRTUALIZATION_DEFER_DATA` setting `false` (see
   `docs/static/feature-flags.json` lines 269–272), charts that are off-screen 
still mount
   and still call `postChartFormData`, issuing backend queries despite being 
visually "not
   rendered". This contradicts the documentation claim at lines 60–63 that 
virtualization
   alone prevents off-screen charts from fetching data.
   ```
   </details>
   
   [Fix in 
Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20docs%2Fadmin_docs%2Fconfiguration%2Fdashboard-performance.mdx%0A%2A%2ALine%3A%2A%2A%2060%3A63%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20The%20docs%20currently%20state%20that%20charts%20outside%20the%20viewport%20%22don%27t%20fetch%20data%22%20under%20%60DASHBOARD_VIRTUALIZATION%60%2C%20but%20in%20code%20the%20data-request%20deferral%20is%20controlled%20by%20the%20separate%20%60DASHBOARD_VIRTUALIZATION_DEFER_DATA%60%20flag%20%28default%20%60False%60%29.%20This%20will%20mislead%20operators%20into%20expecting%20reduced%20backend%20query%20load%20from%20virtualization%20alone.%20Update%20this%20section%20to%20clarify%20that%20virtualization%20gates%20rendering%2C%20while%20off-screen%20query%20deferral%20depends%20on%20enabling%20the%20defer-data%20flag.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20I
 
f%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A)
 | [Fix in VSCode 
Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20docs%2Fadmin_docs%2Fconfiguration%2Fdashboard-performance.mdx%0A%2A%2ALine%3A%2A%2A%2060%3A63%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20The%20docs%20currently%20state%20that%20charts%20outside%20the%20viewport%20%22don%27t%20fetch%20data%22%20under%20%60DASHBOARD_VIRTUALIZATION%60%2C%20but%20in%20code%20the%20data-request%20deferral%20is%20c
 
ontrolled%20by%20the%20separate%20%60DASHBOARD_VIRTUALIZATION_DEFER_DATA%60%20flag%20%28default%20%60False%60%29.%20This%20will%20mislead%20operators%20into%20expecting%20reduced%20backend%20query%20load%20from%20virtualization%20alone.%20Update%20this%20section%20to%20clarify%20that%20virtualization%20gates%20rendering%2C%20while%20off-screen%20query%20deferral%20depends%20on%20enabling%20the%20defer-data%20flag.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docs/admin_docs/configuration/dashboard-performance.mdx
   **Line:** 60:63
   **Comment:**
        *Logic Error: The docs currently state that charts outside the viewport 
"don't fetch data" under `DASHBOARD_VIRTUALIZATION`, but in code the 
data-request deferral is controlled by the separate 
`DASHBOARD_VIRTUALIZATION_DEFER_DATA` flag (default `False`). This will mislead 
operators into expecting reduced backend query load from virtualization alone. 
Update this section to clarify that virtualization gates rendering, while 
off-screen query deferral depends on enabling the defer-data flag.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40238&comment_hash=4b98834ab0fa3fcf820c18eb501b0c8349ca88fe242dbbb48b8f093770f10a1d&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40238&comment_hash=4b98834ab0fa3fcf820c18eb501b0c8349ca88fe242dbbb48b8f093770f10a1d&reaction=dislike'>👎</a>



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