You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by "Fine0830 (via GitHub)" <gi...@apache.org> on 2025/07/30 11:32:46 UTC

[PR] fix: split queries for topology to avoid page crash [skywalking-booster-ui]

Fine0830 opened a new pull request, #485:
URL: https://github.com/apache/skywalking-booster-ui/pull/485

   Screenshots
   
   https://github.com/user-attachments/assets/1edd8409-0fd9-4bd8-bd88-c55176a2c69f
   
   
   https://github.com/user-attachments/assets/e09295fd-14cc-4cd1-8236-0ab24a5a9e4a
   
   
   Signed-off-by: Qiuxia Fan <qi...@apache.org>
   


-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: split queries for topology to avoid page crash [skywalking-booster-ui]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #485:
URL: https://github.com/apache/skywalking-booster-ui/pull/485#discussion_r2242338828


##########
src/hooks/useExpressionsProcessor.ts:
##########
@@ -26,10 +32,17 @@ import type { Instance, Endpoint, Service } from "@/types/selector";
 import type { Node, Call } from "@/types/topology";
 
 function chunkArray(array: any[], chunkSize: number) {
+  if (chunkSize === 0) {
+    return [array];

Review Comment:
   The check for chunkSize === 0 will cause an infinite loop in the for loop below since i += chunkSize would never increment i. Consider returning an empty array or throwing an error instead.
   ```suggestion
     if (chunkSize <= 0) {
       throw new Error("chunkSize must be greater than 0");
   ```



##########
src/store/modules/topology.ts:
##########
@@ -223,14 +223,14 @@ export const topologyStore = defineStore({
     setNodeMetricValue(m: MetricVal) {
       this.nodeMetricValue = m;
     },
-    setLegendValues(expressions: string, data: { [key: string]: any }) {
+    async setLegendValues(expression: string, data: Indexable) {

Review Comment:
   The method is marked as async but doesn't contain any await statements or return a Promise. Remove the async keyword since this is a synchronous operation.
   ```suggestion
       setLegendValues(expression: string, data: Indexable) {
   ```



##########
src/store/modules/topology.ts:
##########
@@ -223,14 +223,14 @@ export const topologyStore = defineStore({
     setNodeMetricValue(m: MetricVal) {
       this.nodeMetricValue = m;
     },
-    setLegendValues(expressions: string, data: { [key: string]: any }) {
+    async setLegendValues(expression: string, data: Indexable) {
       const nodeArr = this.nodes.filter((d: Node) => d.isReal);
+
       for (let idx = 0; idx < nodeArr.length; idx++) {
-        for (let index = 0; index < expressions.length; index++) {
-          const k = "expression" + idx + index;
-          if (expressions[index]) {
-            nodeArr[idx][expressions[index]] = Number(data[k].results[0].values[0].value);
-          }
+        if (expression) {
+          nodeArr[idx][expression] = Number(
+            data[expression].values.find((d: { id: string; value: string }) => d.id === nodeArr[idx].id)?.value,

Review Comment:
   Missing null safety check for data[expression]. If data[expression] is undefined, this will throw an error. Add optional chaining: data[expression]?.values?.find(...)
   ```suggestion
               data[expression]?.values?.find((d: { id: string; value: string }) => d.id === nodeArr[idx].id)?.value,
   ```



-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix: split queries for topology to avoid page crash [skywalking-booster-ui]

Posted by "wu-sheng (via GitHub)" <gi...@apache.org>.
wu-sheng merged PR #485:
URL: https://github.com/apache/skywalking-booster-ui/pull/485


-- 
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: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org