Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
Workflow library browsing
Paths are relative to the webv2 package.
src/features/workflow/data/libraryBrowseStore.ts owns account-scoped server listings, navigation positions, and demand-driven enrichment. Search, place (category, visibility and, for Recent, opened state), checked tags (any of, kept sorted so one selection is one view), order, totals, per-place totals and tag counts are server-authoritative. Per-place totals come from one-row probes once per library opening, skipping the place whose first page that opening loads, and from each unfiltered listing or cached view of the current place. Library mutations keep previous totals visible and refresh known or pending place probes while the listing is held; a probe started before a mutation cannot publish afterward. A recorded open or run drops cached views ordered by last opened or last run and refreshes the current one in that order. A result position is a server offset, not an index in a locally filtered subset.
The active view retains at most 60 consecutive metadata entries. Requests usually align to three server pages of 20; a tall viewport spanning four pages retains partial edge pages within the same 60-entry bound. Its startIndex locates that window in the full server result. loadWorkflowLibraryRange fetches missing pages, reusing only complete resident page positions from the current list generation while the window is no more than 30 seconds old. Partial reads preserve that conservative window age; only a read of every retained position renews it, including rereads after a changed total. Stale cached views remain ineligible for position reuse until a fresh list read completes, including when revalidation queues behind another filter. Partial edge pages must be read again before extension. Forced Retry and list revalidation read resident positions again. Known mutations immediately disable reuse and fence existing first-page, range and refresh publications before notifying subscribers, even when revalidation queues behind another filter. A changed total detected by a missing-page read also rereads reused offsets. The server supplies no list snapshot version, so concurrent external reorderings still converge through revalidation; newer range requests abort and fence older requests. List revalidation reads the pages intersecting the resident window and retains only its bounded positions; selected metadata is revalidated independently. selectWorkflowLibraryEntry selects the freshest matching resident or selected revision from a supplied snapshot, preferring selected state (including errors) at equal revisions. Both enrichment scheduling and the dialog use this policy so detail and preview cannot fall behind selected validation. Because scheduling then skips a pending list copy of the selected workflow, every list publication gives that copy the selected enrichment at an equal revision, so its card, missing-model count and preview match the rail without another read. Invalidation drops enrichment while preserving the selected identity, and only a confirmed removal or access loss clears that pin. Transient failures retain its metadata with a retryable detail error. If deletions move that window beyond the end, it reads the last remaining page. The eight least-recently-used view records retain metadata, totals and one logical scroll anchor per view, with no parsed documents: at most 540 metadata entries across current and cached views, plus one selected entry. Returning to an evicted view starts a fresh server listing.
The grid and the list supply visible workflow identities before overscan so the 48-identity enrichment bound reaches every visible card even in tall viewports. During restoration, its target rows take that priority until the measured viewport reaches them. Selected detail supplies a separate identity and has priority over visible work. Four workers perform revision-aware raw reads, parsing and requirement extraction. There is no accumulated enrichment queue. Leaving demand aborts work and drops parsed documents immediately; an aborted, obsolete-generation, old-revision or old-account completion cannot publish. Selected detail can retain one document outside the metadata window. The in-place preview draws the selected workflow's document, so it adds none; while it shows, the hidden grid or list keeps the demand it had, and stepping past the resident window reads that position as scrolling would. Operations consume documents through their existing operation lifetimes. The raw record cache in libraryCache.ts separately retains at most 50 records, validated against list revision and cleared on invalidation/account change.
src/features/workflow/ui/library/WorkflowLibraryGrid.tsx virtualizes rows with one to six columns, as many as fit at the account's card size (at least 150 px per small card, 220 px per large card), against the actual Scrollable viewport, measures mounted rows and observes viewport width. The account's view records retain only a server item position and the fraction of its row above the viewport, not row measurement caches. The dialog does not subscribe to anchor changes: each keyed grid reads its filter-owned anchor once at mount, so fractional scrolling does not render the shell or detail rail. A returning grid waits for its actual width before demanding the anchor's range, navigates to that row through the virtualizer, and translates the saved fraction using the resident row's measured geometry. Preliminary top/incorrect-column ranges cannot evict that window. Restoration moves only the grid viewport, never focus; keyboard, pointer or wheel intent cancels it, and filter/account changes or unmount discard it. In narrow dialogs the detail rail becomes a bottom sheet: a one-row summary under the grid whose expanded details lie over the grid, which stays laid out (invisible and out of the tab order) and keeps its scroll position. The viewport height is capped in estimated rows by column count (workflowLibraryGridLayout.ts): 15 up to three columns, 10 at four, 8 at five and 7 at six, with two overscan rows on either side up to four columns and one at five and six. The row estimate is a lower bound, so the rows a capped viewport spans stay within the 48-identity enrichment bound, and with overscan within the 60-position metadata bound, even on unusually tall displays; one focused/menu row may also remain mounted. Focus pinning retains metadata only; a confirmed local deletion clears the matching pin without discarding a valid off-window focused or menu card. Tab navigation scrolls and refetches the next position before focusing its card/menu control. Matching range requests share transport while their metadata reuse remains fresh; an expired partial flight is replaced by a full read. Each caller checks its own requested positions after settlement; superseded, failed or removed targets do not claim readiness. Focus intent waits for resident metadata and mounted controls, and ends on another keyboard/pointer/focus intent, filter/account change, or unmount. A sticky viewport notice exposes range failures, and explicit Retry revalidates even resident positions. A pinned card's action refetches its metadata position before acting. A card's or row's actions menu acts on that workflow without selecting it: it resolves its target from the resident window or the selected pin, and closes once the target leaves both. The project view uses the same virtual rows over its project-owned collection without making library reads. Library selection survives metadata eviction; filters and accounts reset its demand through keyed mount leases. An explicit selection remains preferred when present in the returned view. Otherwise detail selects the first resident entry near the restored viewport, avoiding a page-zero read that would evict its anchor window; per-view selections are not cached.
The account can show either view as a list instead (src/features/workflow/ui/library/WorkflowLibraryList.tsx), built on the platform List with fixed 54 px rows. Both layouts derive the demanded identities and hold the range and visible demand through the shared demand module (workflowLibraryCollection.tsx): one mount lease per range, visible rows first, released when the viewport leaves. The list has one row per server position, keyed by that position: a position outside the resident window renders as a busy placeholder row with the same button and controls, so when its page arrives the row, and focus on it, stay put. The List's visible range plus eight rows on either side is the range it loads, so a viewport of up to 44 rows (about 2,400 px) stays within the 48-identity and 60-position bounds; on a taller one the rows past the 60-position window stay placeholders. The rows last focused or given a menu and the selected row are kept with their positions while their pages are evicted, metadata only, so they keep their names. A selection made while its row is outside the window (a duplicate's copy, a switch from the grid) is marked as the List's active row once its page is resident; until then the List's tab stop falls back to the row focused last, else to its first row, placeholder or not. The list shares the grid's per-view anchor: it records the first visible position and its fraction whenever its visible range moves and on unmount, and a returning list opens at that offset. It needs no restoration loop, since its fixed rows map a position to an offset exactly.
The owner tests exercise 1,000 workflows with 40 nodes each, repeated view changes, return positions, selected pins and obsolete completions. getWorkflowLibraryBrowseRetention exposes deterministic resource counts for that fixture. It does not measure browser heap or production latency.