Commit 211425e
* fix(objectql): return real total/hasMore from findData (#2212)
findData previously returned stub pagination metadata — `total` equal to
the current page's record count and `hasMore` hard-coded to false. The
frontend grid therefore believed every result set fit on a single page and
never requested records beyond the first batch (e.g. row #51+ unreachable).
When a `limit` is present the response is one page, so `records.length` is
the page size, not the match total. Run engine.count() over the same `where`
to report the true total and derive `hasMore` from offset + page vs total.
engine.count() only honors `where`, so for `search`/`distinct` queries (which
it can't reproduce) fall back to a page-local estimate instead of a wrong
total. Without a limit the full set is returned, so its length is the total.
The aggregation/grouped branch had the same bug: it sliced to `limit` but
reported the sliced length as the total with hasMore=false. It now reports
the full grouped count as total and hasMore from whether the slice dropped
any groups.
Adds 5 pagination tests to protocol-data.test.ts (39/39 pass).
* chore(changeset): add patch changeset for findData pagination fix (#2212)
Closes the missing-changeset CI gate; @objectstack/objectql user-facing fix.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 6d3bf54 commit 211425e
3 files changed
Lines changed: 119 additions & 7 deletions
File tree
- .changeset
- packages/objectql/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
154 | 155 | | |
155 | 156 | | |
156 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
157 | 216 | | |
158 | 217 | | |
159 | 218 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2164 | 2164 | | |
2165 | 2165 | | |
2166 | 2166 | | |
2167 | | - | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
2168 | 2170 | | |
2169 | 2171 | | |
2170 | 2172 | | |
2171 | 2173 | | |
2172 | 2174 | | |
2173 | 2175 | | |
2174 | | - | |
2175 | | - | |
| 2176 | + | |
| 2177 | + | |
2176 | 2178 | | |
2177 | 2179 | | |
2178 | 2180 | | |
2179 | 2181 | | |
2180 | | - | |
2181 | | - | |
| 2182 | + | |
| 2183 | + | |
| 2184 | + | |
| 2185 | + | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
| 2189 | + | |
| 2190 | + | |
| 2191 | + | |
| 2192 | + | |
| 2193 | + | |
| 2194 | + | |
| 2195 | + | |
| 2196 | + | |
| 2197 | + | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
2182 | 2215 | | |
2183 | 2216 | | |
2184 | 2217 | | |
2185 | | - | |
2186 | | - | |
| 2218 | + | |
| 2219 | + | |
2187 | 2220 | | |
2188 | 2221 | | |
2189 | 2222 | | |
| |||
0 commit comments