[BUG][FIX]: 使用 before[listChangedAt] + before[id] 时,无限列表分页返回 HTTP 500
1. Controller input coercion fails for before
文件:server/api/controllers/cards/index.js 当前代码: before: { type: 'json', custom: isBefore, }, 使用真实的查询,例如: GET /api/lists//cards?before[listChangedAt]=2026-08-26T06:11:45.932Z&before[id]=1849965776484697144 PLANKA 接收了嵌套查询对象,但 type: 'json' 输入路径在控制器处理器可以使用它之前就失败了,导致 HTTP 500 并出现: Cannot read properties of undefined (reading 'name') 在一个仪器化的 2.1.1 测试实例中,将输入更改为: before: { type: 'ref', custom: isBefore, }, 导致解析对象在未经更改的情况下到达 isBefore()。现有验证器然后正确验证: 普通对象形状; 完全是 listChangedAt + id; 严格的 ISO-8601 时间戳; 有效的 PLANKA ID。 ### 2. 需要使用原生 SQL 路径进行 Cursor 分页 文件:server/api/hooks/query-methods/models/Card.js 原生 SQL 实现中已经包含正确的复合 Cursor 条件: card.list_changed_at < cursor_timestamp OR ( card.list_changed_at = cursor_timestamp AND card.id < cursor_id ) 现有的 Waterline 路径通过条件来表达相同的条件,但这是最初为 before 僅请求而达到的路径。 使用原生 SQL 实现进行 before 避免了那个 Cursor 条件路径,并重用了已经正确的复合谓词。 ### 3. 原生 SQL 分页需要在 LIMIT 之前进行确定性排序 原生 SQL 分支目前结束为: query += LIMIT ${LIMIT}; 无 ORDER BY。 对于 Cursor 分页,仅在查询之后排序无法修复无序的服务器端 LIMIT:行可能已经被排除…
内容来源: plankanban/planka