richardfogaca commented on code in PR #37459:
URL: https://github.com/apache/superset/pull/37459#discussion_r2790708448


##########
superset-frontend/plugins/plugin-chart-echarts/src/Tree/buildQuery.ts:
##########
@@ -16,14 +16,36 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { buildQueryContext, QueryFormData } from '@superset-ui/core';
+import { buildQueryContext, QueryFormOrderBy } from '@superset-ui/core';
+import { EchartsTreeFormData } from './types';
+
+export default function buildQuery(formData: EchartsTreeFormData) {
+  const { id, parent, name, row_limit } = formData;
+  const orderby: QueryFormOrderBy[] = [];
+  const shouldApplyOrderBy =
+    row_limit !== undefined && row_limit !== null && row_limit !== 0;
+  const orderbyColumns: string[] = [];
+
+  [parent, id, name].forEach(column => {
+    if (column) {
+      orderbyColumns.push(column);
+    }
+  });
+  orderbyColumns.forEach(column => {
+    orderby.push([column, true]);
+  });

Review Comment:
   the orderby ensures deterministic row ordering so chart elements maintain 
stable positions across dashboard auto-refreshes — without explicit ordering, 
the database can return rows in arbitrary order causing visual jumps



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