dbx icon indicating copy to clipboard operation
dbx copied to clipboard

[Bug] Load-all from a jumped-to page stops at the result-row cap when the total row count is unknown

Open yiqiui opened this issue 1 month ago • 1 comments

数据库类型和版本 / Database type and version

逻辑/前端问题,与具体数据库无关(在组件测试中复现)。 / Front-end logic bug, DB-agnostic (reproduced in a component test).

问题描述 / Problem description

  1. 复现步骤 / Steps:
    1. 打开一个 总行数未知 的结果(例如 SQL 查询结果,没有 COUNT)。
    2. 保持结果行数上限开启(默认 queryResultMaxRowsEnabled=true, queryResultMaxRows=100000)。
    3. 跳转到第 2 页或更后(pageOffset > 0)。
    4. 点击「加载全部并转到末行」。
  2. 期望结果 / Expected: 与在第 1 页点击「加载全部」一致——从 offset 0 重载后继续分块,直到服务器返回不足一批为止(必要时可超过上限,见 #10752)。
  3. 实际结果 / Actual: 只发出一次请求 offset=0, limit=<cap>;拿到 cap 行后停止,不再续读。由于结果仍为 has_more=true,也不会标记「已全部加载」,界面停在 cap 行且没有任何提示。
  4. 截图/日志 / Logs: 见下方证据。

根因 / Root cause

#12325 的「跳页重载」分支只做单次重载:

// apps/desktop/src/components/grid/DataGrid.vue — loadAllRowsAndGoToLast()
const reloadLimit = total > 0 ? total : infiniteScrollMaxRows.value; // total 未知 → 退化为 cap
startLoadAllRows({ offset: 0, limit: reloadLimit }, true);
// startLoadAllRows(..., reloadFromFirstRow=true) 会令 loadAllRowsLoopActive = false
// ⇒ 不会进入 finishOrContinueLoadAllRun 的续读循环

total 已知时 limit = total 可以一次覆盖全部;但 total 未知且真实行数 > cap 时,只加载 cap 行,且不进入续读循环。作为对比,从第 1 页触发的 load-all 会继续分块越过 cap。

证据 / Evidence(用仓库自带测试 harness 复现)

  • 跳页场景(pageOffset=80、总数未知、cap=5):仅 1 次 paginate(0, 5, append=false);服务端返回 5 行 has_more=true 后无后续请求。
  • 第 1 页场景(pageOffset=0、总数未知、cap=5):paginate(2, 3, append=true) → 落地后 paginate(5, 3, append=true),越过 cap 继续。

补充风险 / Secondary risk

若服务端在重载结果里不带 has_more,DataGrid.vue 的重载分支会因 !truncated && has_more !== true 直接置 infiniteScrollAllLoaded = true,而此时实际只加载了 cap 行 → 可能出现「静默少行却显示已全部加载」。

建议修复 / Suggested fix

重载落地后,若 has_more === true && !truncated,重新进入 load-all 循环(loadAllRowsLoopActive = true,并用 finishOrContinueLoadAllRun / nextLoadAllSegment 续读),在保持「替换而非拼接」语义的同时继续分块,行为与第 1 页路径对齐。

支持信息 / Support information

DBX v0.6.44(main @ c2b7e427a)。通过 gh 提交,无法填写表单字段,故以文本给出。

优先级 / Priority

🟡 P2 普通 · 按排期处理 / Normal · Schedule as appropriate

补充信息 / Additional information

关联:#11940 / #12325(跳页 load-all 重载);#12286 已作为重复被关闭。此问题为 #12325 修复后的残余边界。

yiqiui avatar Oct 16 '26 05:10 yiqiui

I am working on this issue, a fix PR will follow.

lxk955 avatar Oct 16 '26 05:10 lxk955