dev vouch dev on at. thats about it atvouch.dev
8
fork

Configure Feed

Select the types of activity you want to include in your feed.

increase limit to 1000 and make frontend load everything upfront

Luna 39e17948 833862d9

+35 -18
+2 -2
appview/lib/atvouch/xrpc_router.ex
··· 136 136 137 137 defp parse_limit(%{"limit" => limit_str}) do 138 138 case Integer.parse(limit_str) do 139 - {limit, ""} when limit >= 1 and limit <= 100 -> {:ok, limit} 140 - _ -> {:error, "limit must be an integer between 1 and 100"} 139 + {limit, ""} when limit >= 1 and limit <= 1000 -> {:ok, limit} 140 + _ -> {:error, "limit must be an integer between 1 and 1000"} 141 141 end 142 142 end 143 143
+6 -6
appview/test/atvouch/xrpc_vouches_test.exs
··· 189 189 assert conn.status == 400 190 190 end 191 191 192 - test "returns 400 with limit over 100" do 192 + test "returns 400 with limit over 1000" do 193 193 conn = 194 - conn(:get, "/xrpc/dev.atvouch.graph.getCurrentUserVouches?limit=101") 194 + conn(:get, "/xrpc/dev.atvouch.graph.getCurrentUserVouches?limit=1001") 195 195 |> put_req_header("authorization", "Bearer valid-token:did:plc:alice") 196 196 |> Atvouch.Router.call(@opts) 197 197 ··· 396 396 assert conn.status == 400 397 397 end 398 398 399 - test "returns 400 with limit over 100" do 399 + test "returns 400 with limit over 1000" do 400 400 conn = 401 - conn(:get, "/xrpc/dev.atvouch.graph.getRemoteVouches?limit=101") 401 + conn(:get, "/xrpc/dev.atvouch.graph.getRemoteVouches?limit=1001") 402 402 |> put_req_header("authorization", "Bearer valid-token:did:plc:alice") 403 403 |> Atvouch.Router.call(@opts) 404 404 ··· 538 538 assert conn.status == 400 539 539 end 540 540 541 - test "returns 400 with limit over 100" do 541 + test "returns 400 with limit over 1000" do 542 542 conn = 543 - conn(:get, "/xrpc/dev.atvouch.graph.getEntireGraph?limit=101") 543 + conn(:get, "/xrpc/dev.atvouch.graph.getEntireGraph?limit=1001") 544 544 |> Atvouch.Router.call(@opts) 545 545 546 546 assert conn.status == 400
+25 -8
frontend/src/App.tsx
··· 191 191 setVouchesLoading(true); 192 192 setVouchesError(null); 193 193 try { 194 - const result = await listVouches(agent); 195 - setVouches(result.vouches); 196 - setVouchesTotal(result.total); 197 - setVouchesCursor(result.cursor); 194 + let allVouches: VouchEntry[] = []; 195 + let cursor: string | undefined; 196 + let total = 0; 197 + do { 198 + const result = await listVouches(agent, { limit: 1000, cursor }); 199 + allVouches = [...allVouches, ...result.vouches]; 200 + total = result.total; 201 + cursor = result.cursor; 202 + } while (cursor); 203 + setVouches(allVouches); 204 + setVouchesTotal(total); 205 + setVouchesCursor(undefined); 198 206 } catch (err) { 199 207 setVouchesError(String(err)); 200 208 } ··· 428 436 setLoading(true); 429 437 setError(null); 430 438 try { 431 - const result = await fetchRemoteVouchers(agent); 432 - setVouchers(await resolveVouches(result.vouches)); 433 - setTotal(result.total); 434 - setCursor(result.cursor); 439 + let allVouches: RemoteVoucher[] = []; 440 + let pageCursor: string | undefined; 441 + let total = 0; 442 + do { 443 + const result = await fetchRemoteVouchers(agent, { limit: 1000, cursor: pageCursor }); 444 + const resolved = await resolveVouches(result.vouches); 445 + allVouches = [...allVouches, ...resolved]; 446 + total = result.total; 447 + pageCursor = result.cursor; 448 + } while (pageCursor); 449 + setVouchers(allVouches); 450 + setTotal(total); 451 + setCursor(undefined); 435 452 } catch (err) { 436 453 setError(String(err)); 437 454 }
+1 -1
lexicons/dev/atvouch/graph/getCurrentUserVouches.json
··· 11 11 "limit": { 12 12 "type": "integer", 13 13 "minimum": 1, 14 - "maximum": 100, 14 + "maximum": 1000, 15 15 "default": 50 16 16 }, 17 17 "cursor": { "type": "string" }
+1 -1
lexicons/dev/atvouch/graph/getRemoteVouches.json
··· 11 11 "limit": { 12 12 "type": "integer", 13 13 "minimum": 1, 14 - "maximum": 100, 14 + "maximum": 1000, 15 15 "default": 50 16 16 }, 17 17 "cursor": { "type": "string" }