A resource can show only its newest few
`limit: n` on a resource spec, applied after `jq`. The releases card is what asked for it: a page that grows by one card per release gets longer forever, and the cut a visitor should run is the newest one — the rest are history, not an invitation. redoal's card had every release on it. After `jq` rather than before, for two reasons: it caps what the page will actually render whatever the filter did, and content that reorders with the filter can then take the top of its own ordering rather than the top of the source's. A source yielding a single record has no length and passes through untouched — turning one record into an empty list would be worse than ignoring a limit that cannot apply. `limit: 0` on a list does mean nothing, and the `empty` line speaks instead, which is a coherent thing for content to ask for. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ByshXuDEzH8hXh5qp4VgGk
This commit is contained in:
co-authored by
Claude Opus 5
parent
48ae5e07c2
commit
22d086f9e1
@@ -519,6 +519,18 @@ pub struct ResourceSpec {
|
||||
/// it where the silence needs a voice ("Nothing released yet").
|
||||
#[serde(default)]
|
||||
pub empty: Option<String>,
|
||||
/// Show at most this many items, applied after `jq`. For a feed
|
||||
/// where only the newest matters: a releases card wants the cut you
|
||||
/// should run, not every cut there has ever been, and a page that
|
||||
/// grows by one card per release gets longer forever.
|
||||
///
|
||||
/// After `jq` rather than before, so it caps what the page will
|
||||
/// actually render whatever the filter did — and so content can
|
||||
/// reorder with jq and still take the top of its own ordering. A
|
||||
/// source that yields a single record has no length and passes
|
||||
/// through untouched. `None` shows everything.
|
||||
#[serde(default)]
|
||||
pub limit: Option<usize>,
|
||||
}
|
||||
|
||||
/// Where a resource's live data comes from. `Kv` (a NATS KV bucket
|
||||
|
||||
Reference in New Issue
Block a user