Repository navigation
feat(assets): adopt cursor pagination in the flat-output infinite scroll - #12774
mattmillerai wants to merge 18 commits into
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesFlat Output Pagination Migration
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 6 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (6 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/stores/assetsStore.test.ts (1)
1524-1535: 💤 Low valueConsider function declaration for pure helper.
The
makePagehelper is a pure function. Per coding guidelines, prefer function declarations over expressions for pure functions.♻️ Optional refactor to function declaration
-const makePage = ( +function makePage( assets: AssetItem[], { hasMore = false, nextCursor }: { hasMore?: boolean; nextCursor?: string } = {} -): AssetResponse => ({ +): AssetResponse { + return { assets, total: assets.length, has_more: hasMore, ...(nextCursor === undefined ? {} : { next_cursor: nextCursor }) -}) + } +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/stores/assetsStore.test.ts` around lines 1524 - 1535, Convert the pure helper const makePage = (...) => (...) expression into a function declaration to follow coding guidelines: replace the arrow-const definition of makePage with a function declaration function makePage(assets: AssetItem[], { hasMore = false, nextCursor }: { hasMore?: boolean; nextCursor?: string } = {}): AssetResponse { return { assets, total: assets.length, has_more: hasMore, ...(nextCursor === undefined ? {} : { next_cursor: nextCursor }) }; } so the helper remains pure and types (AssetItem, AssetResponse) are preserved and easy to locate.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/stores/assetsStore.test.ts`:
- Around line 1524-1535: Convert the pure helper const makePage = (...) => (...)
expression into a function declaration to follow coding guidelines: replace the
arrow-const definition of makePage with a function declaration function
makePage(assets: AssetItem[], { hasMore = false, nextCursor }: { hasMore?:
boolean; nextCursor?: string } = {}): AssetResponse { return { assets, total:
assets.length, has_more: hasMore, ...(nextCursor === undefined ? {} : {
next_cursor: nextCursor }) }; } so the helper remains pure and types (AssetItem,
AssetResponse) are preserved and easy to locate.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b1bf92de-c477-4f03-9338-76a5c250954d
📒 Files selected for processing (2)
src/stores/assetsStore.test.tssrc/stores/assetsStore.ts
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #12774 +/- ##
==========================================
- Coverage 78.75% 72.36% -6.39%
==========================================
Files 1868 1782 -86
Lines 115515 94067 -21448
Branches 33610 26137 -7473
==========================================
- Hits 90979 68076 -22903
- Misses 23992 25838 +1846
+ Partials 544 153 -391
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1174 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
Manual verification against testcloud staging (dev:cloud + headed Chrome, network capture on
Findings for reviewers:
Created by Claude Code |
Calls the reusable Comfy-Org/github-workflows cursor-review.yml (single source of truth for panel, judge, prompts, scripts) instead of a standalone copy. Label-gated to the team; secret-bearing jobs skip fork PRs. Judge overridden to Opus 4.8.
dante01yoon
left a comment
There was a problem hiding this comment.
Read-only review at c5aaeba (not approving, per request).
The offset→cursor migration in fetchFlatOutputs is clean and the behavioral coverage is genuinely strong: server-authoritative has_more over the old length heuristic, non-advancing-cursor termination (cursorStuck), empty-page-as-terminal, the offset fallback for cursor-less backends, and cursor-preservation-on-loadMore-failure are all exercised. No blocking findings.
One thing I like: flatOutputOffset keeps accumulating even while paging by cursor, so a mid-session cursor drop falls back to a correct offset. Reads as redundant in cursor mode — a one-line comment at the flatOutputOffset.value += batch.length site noting that's deliberate would help the next reader.
The CodeRabbit "missing E2E" pre-merge flag is acceptable here: this is store-level logic fully covered by unit tests, and the Playwright jobs fixture mints no cursors, so an e2e would only re-exercise the offset fallback.
- fetchFlatOutputs threads next_cursor into after on loadMore, falling back to offset paging for backends that mint no cursors - hasMore is now server-authoritative (has_more) instead of the page-length heuristic, with empty-page and non-advancing-cursor guards - reset path clears the cursor and stays a from-the-top head fetch
- pin cursor preservation across a failed loadMore (retry resumes via after) - pin cursor clearing on refresh via the failed-refresh path (kills a surviving mutant on the reset-path clear) - rename error test to match actual preserve-on-error behavior - use vi.resetAllMocks to isolate per-test once-queues
c5aaeba to
5463ad4
Compare
There was a problem hiding this comment.
🔍 Cursor Review — Consolidated panel
Triggered by @mattmillerai.
Found 6 finding(s).
| Severity | Count |
|---|---|
| 🟠 High | 1 |
| 🟡 Medium | 3 |
| 🟢 Low | 1 |
| ⚪ Nit | 1 |
Panel: 5/8 reviewers contributed findings.
Reviewers that did not contribute: gemini-3.1-pro:adversarial (error), kimi-k2.5:adversarial (empty), kimi-k2.5:edge-case (empty)
…le-list append On refresh failure the catch block returned [] but left flatOutputAssets intact. The reset block had already cleared seenIds and rewound offset to 0, so the next loadMoreFlatOutputs would append fresh page-0 items onto the retained stale list, producing visible duplicates. Clear flatOutputAssets when the refresh path fails so the list stays consistent with the reset cursor/offset state. Add assertions to the existing refresh-failure and restart-from-head tests to catch this regression.
|
Deployment failed with the following error: Learn More: https://vercel.com/uy-tieu-s-projects?upgradeToPro=build-rate-limit |
… widget select dropdown (#12780) ## Summary Wires the previously-dormant `loadMore` path of the flat-output assets provider into the widget select dropdown, so cloud users with more than one page of outputs can actually reach them. Stacked on #12774 (FE-985); retargets to `main` when that merges. ## Changes - **What**: `VirtualGrid`'s existing `approach-end` event now forwards through `FormDropdownMenu` → `FormDropdown` → `WidgetSelectDropdown`, which calls `outputMediaAssets.loadMore()` guarded by `hasMore`/`isLoadingMore` and debounced 300ms — the same idiom as `AssetsSidebarTab`. A spinner row (`loadingMore` prop) renders below the grid while a page is in flight. On cloud this drives the FE-985 cursor walk; on OSS it drives the FE-962 jobs-history cursor walk via `useAssetsApi`. ## Review Focus - Verified end-to-end against the dev server with a mocked 100-asset backend: scroll → `after=cur-40` → `after=cur-80` → stops at `has_more:false` (100/100, no duplicate fetches). - **Known platform limitation, not introduced here**: VueUse ≥14's `throttleFilter` with `leading=false` drops events spaced wider than the throttle window, so `useScroll`'s `throttle: 64` in `VirtualGrid` never reports discrete mouse-wheel scrolls — only high-frequency (trackpad-style) scrolling triggers `approach-end`. This equally affects the assets sidebar and manager dialog today; bug filed separately with root cause. Fixing it makes this wiring work for wheel users with no further changes. - Underfill edge: `approach-end` cannot fire when loaded items don't overflow the viewport (shared VirtualGrid trait with the sidebar); with the 200-item page size this only matters for heavily-filtered media types. - Fixes FE-988 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: GitHub Action <action@github.com>
…e-flat-output-infinite
christian-byrne
left a comment
There was a problem hiding this comment.
Verified the follow-up fixes after the latest main merge. Cursor/offset fallback, terminal guards, refresh/load-more concurrency, and refresh-failure behavior remain covered; the focused assets store suite passes locally (75 tests).
… widget select dropdown (#12780) ## Summary Wires the previously-dormant `loadMore` path of the flat-output assets provider into the widget select dropdown, so cloud users with more than one page of outputs can actually reach them. Stacked on #12774 (FE-985); retargets to `main` when that merges. ## Changes - **What**: `VirtualGrid`'s existing `approach-end` event now forwards through `FormDropdownMenu` → `FormDropdown` → `WidgetSelectDropdown`, which calls `outputMediaAssets.loadMore()` guarded by `hasMore`/`isLoadingMore` and debounced 300ms — the same idiom as `AssetsSidebarTab`. A spinner row (`loadingMore` prop) renders below the grid while a page is in flight. On cloud this drives the FE-985 cursor walk; on OSS it drives the FE-962 jobs-history cursor walk via `useAssetsApi`. ## Review Focus - Verified end-to-end against the dev server with a mocked 100-asset backend: scroll → `after=cur-40` → `after=cur-80` → stops at `has_more:false` (100/100, no duplicate fetches). - **Known platform limitation, not introduced here**: VueUse ≥14's `throttleFilter` with `leading=false` drops events spaced wider than the throttle window, so `useScroll`'s `throttle: 64` in `VirtualGrid` never reports discrete mouse-wheel scrolls — only high-frequency (trackpad-style) scrolling triggers `approach-end`. This equally affects the assets sidebar and manager dialog today; bug filed separately with root cause. Fixing it makes this wiring work for wheel users with no further changes. - Underfill edge: `approach-end` cannot fire when loaded items don't overflow the viewport (shared VirtualGrid trait with the sidebar); with the 200-item page size this only matters for heavily-filtered media types. - Fixes FE-988 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: GitHub Action <action@github.com>
…cursor-pagination-in-the-flat-output-infinite # Conflicts: # src/stores/assetsStore.ts
a240c98
|
Merged Empty-string cursors: took main's contract, dropped this branch's
|
|
One more divergence from
flatOutputHasMore.value = fresh.length > 0 && page.has_more && !cursorStuckthis branch computes it from the raw batch: flatOutputHasMore.value = batch.length > 0 && hasMore && !cursorStuckBoth keep the empty-page guard (
I kept this branch's version — the truncation bug is reachable with a correct server, while the runaway case needs a misbehaving one and is bounded by user scroll (each |
|
🤖 The reviews loop filed Linear follow-up ticket(s) for review thread(s) deferred as out of scope for this PR:
|
…e-flat-output-infinite
…cursor-pagination-in-the-flat-output-infinite # Conflicts: # eslint.config.ts
AustinMroz
left a comment
There was a problem hiding this comment.
I don't have personal objections to the change, but it will be entirely subsumed by #15381
DrJKL
left a comment
There was a problem hiding this comment.
The cursor regressions are valid and pass locally, but current main replaced this flat-output implementation in #15381 and this branch now conflicts with the base. Please close it as superseded rather than reintroducing the old store path.
|
Closing: core change already landed, remainder covered elsewhere.
Full context for agent readersClosure approved by the repository owner Christian in the private tracking issue blocked-on-christian #504. Inspection: head |
Summary
Migrates the flat-output infinite scroll (
fetchFlatOutputs) from offset paging to the keyset cursor contract (after/next_cursor) now live on core (Comfy-Org/ComfyUI#14014) and cloud (Comfy-Org/cloud#3690), building on the service plumbing from #12720.Changes
fetchFlatOutputsthreadsnext_cursorintoafteron loadMore viagetAssetsPageByTag, with offset paging retained as the fallback for backends that mint no cursors.hasMoreis now server-authoritative (has_more) instead of thepage.length === FLAT_OUTPUT_PAGE_SIZEheuristic, with empty-page and non-advancing-cursor termination guards. The reset path clears the cursor and remains a from-the-top head fetch (the contract has nobeforeparam).Review Focus
Cursor/offset interplay in
fetchFlatOutputs:requestedAfteris captured per request; offset keeps accumulating so a cursor-less response can fall back mid-session.Known, deliberate non-goals: a failed refresh still leaves stale assets with cleared dedupe state (pre-existing behavior, unchanged by this PR), and a stale-cursor 400 has no special recovery — the cursor only lives for one scroll session and a refresh fully recovers. The jobs walk's 400-recovery pattern can be ported later if this surfaces in practice.
Fixes FE-985
🤖 Generated with Claude Code