Skip to content

Commit 3cecc86

Browse files
committed
refactor(resources): correct the row-cache premise and clear an R1b false positive
Two things the migration notes got wrong, now fixed in the places that assert them. The playbook claimed an open table and an embedded one "should hit one cache entry, and forking that doubles every fetch". Half right, and the wrong half was driving a planned change. The SCHEMA is keyed on the table id alone, so it genuinely is one entry on every surface. ROWS are not, and should not be: `pageSize` is in the key, the page pulls 1000-row pages so `ensureAllRowsLoaded` can drain for select-all/export in few round trips, and a panel wants a fast first screen and never drains. One number would either make a chat panel fetch 1000 rows to show ten, or make every bulk operation ten times the requests. The divergence is correct; both the hook and the playbook now say so. `MiniTablePanel` -> `LandingLeadsPanel`. It is hardcoded landing-hero markup with no queries and no relationship to the table resource, so a `Mini` + resource-noun name misread as a per-consumer fork of the real view — to a reader and to the audit. R1b baseline drops 12 -> 11. The R1b note itself was also wrong, claiming every `Embedded*` drops off as its kind gets a canonical view. The `*Actions` members are tab chrome, not views: `EmbeddedFileActions` and `EmbeddedInterfaceActions` outlived their migrations, and `EmbeddedTableActions` just outlived table's. Only the content components go.
1 parent 37519d4 commit 3cecc86

4 files changed

Lines changed: 41 additions & 19 deletions

File tree

apps/sim/app/(landing)/components/landing-preview/components/landing-preview-home/landing-preview-home.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export const LandingPreviewHome = memo(function LandingPreviewHome({
254254
animate={{ width: '55%', opacity: 1 }}
255255
transition={{ duration: 0.35, ease: EASE_OUT }}
256256
>
257-
<MiniTablePanel />
257+
<LandingLeadsPanel />
258258
</m.div>
259259
)}
260260
</AnimatePresence>
@@ -382,9 +382,14 @@ function ChatMarkdown({
382382
}
383383

384384
/**
385-
* Mini Customer Leads table panel matching the resource panel pattern.
385+
* The "Customer Leads" panel in the landing hero's static product mock.
386+
*
387+
* Named for what it is rather than `MiniTablePanel`: it is hardcoded marketing
388+
* markup with no queries and no relationship to the table resource, and a
389+
* `Mini` + resource-noun name reads to both a reader and the resource-view
390+
* audit as a per-consumer fork of the real table view.
386391
*/
387-
function MiniTablePanel() {
392+
function LandingLeadsPanel() {
388393
return (
389394
<div className='flex h-full w-full flex-col bg-[var(--surface-2)]'>
390395
<div className='flex items-center gap-2 border-[var(--border)] border-b px-3 py-2'>

apps/sim/components/resources/MIGRATING-RESOURCES.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,15 @@ page-size split documented on `TABLE_VIEW_PAGE_SIZE`.
140140
`tables/[tableId]/`. Nothing renders differently. Land this alone so the diff is reviewable.
141141

142142
**PR 2 — give it the axes.** `TableView` takes `{ source, grants, host }`. Rows and schema resolve
143-
from the source: workspace scope keeps the existing `tableKeys` factory deliberately — an open table
144-
and an interface's table module *should* hit one cache entry, and forking that doubles every fetch —
145-
while share scope reads a `(token, grantId)` route. Replace the interfaces mini-table with a mount
146-
and delete it.
143+
from the source: workspace scope keeps the existing `tableKeys` factory, while share scope reads a
144+
`(token, grantId)` route. Replace the interfaces mini-table with a mount and delete it.
145+
146+
*Corrected while doing it:* this section used to claim the page and an embedded table "should hit one
147+
cache entry, and forking that doubles every fetch". Half right. The **schema** is keyed on the table
148+
id alone, so it genuinely is one entry everywhere. **Rows** are not, and should not be: `pageSize` is
149+
in the key, the page pulls 1000-row pages so `ensureAllRowsLoaded` can drain for select-all/export in
150+
few round trips, and a panel wants a fast first screen and never drains. One number would either make
151+
a chat panel fetch 1000 rows to show ten, or make every bulk operation ten times the requests.
147152

148153
**PR 3 — public surface.** Token-scoped rows route, `ResourceSeedMap['table']` carrying the column
149154
schema, `/t/[token]` or a table module inside a shared interface.

apps/sim/components/resources/table-view/hooks/use-table-source.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,18 @@ import { shareTableSchema } from '@/resources/table-source'
1616
* Owned here rather than taken from the caller, so two hosts of this view cannot
1717
* key differently: `pageSize` is part of the infinite-rows query key.
1818
*
19-
* KNOWN GAP — this does *not* yet share a cache entry with the tables page,
20-
* which requests `TABLE_LIMITS.MAX_QUERY_LIMIT` (1000) because its grid drains
21-
* every row for client-side sort and filter. Opening a table and viewing it in a
22-
* panel therefore drains it twice. Unifying them is a real behaviour change on
23-
* one surface or the other — either the page fetches in 100s or a panel fetches
24-
* 1000 rows up front — so it is deliberately not smuggled into this move.
19+
* Deliberately NOT the tables page's size, and the two should not be unified.
20+
* `pageSize` is part of the infinite-rows key, so the page and this view keep
21+
* separate row caches — which is correct, because they read differently. The
22+
* page requests `TABLE_LIMITS.MAX_QUERY_LIMIT` (1000) so `ensureAllRowsLoaded`
23+
* can drain a table for select-all, export and bulk delete in few round trips;
24+
* a panel wants its first screen fast and never drains. Forcing one number
25+
* would either make a chat panel fetch 1000 rows to show ten, or make every
26+
* bulk operation ten times as many requests.
27+
*
28+
* The expensive shared half *is* shared: the schema is keyed on the table id
29+
* alone (`tableKeys.detail`), so every surface showing a given table reads one
30+
* entry for its columns.
2531
*
2632
* A share source uses {@link PUBLIC_TABLE_PAGE_SIZE} instead — the public
2733
* contract's hard `limit` ceiling, read from the contract rather than restated.

scripts/check-resource-views.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,19 @@ const RESOURCE_POLICY_BASELINE = {
7878
*/
7979
wrapperMounts: 0,
8080
/**
81-
* R1b — components whose NAME announces a per-consumer fork. 11 of the 12 are
82-
* the mothership panel's `Embedded*` tab chrome for kinds that have no
83-
* canonical view yet (workflow, folder, scheduled task, log, knowledge base);
84-
* the last is a landing-page marketing mock. Every one drops off as its kind
85-
* gets a real view.
81+
* R1b — components whose NAME announces a per-consumer fork. All 11 are the
82+
* mothership panel's `Embedded*` tab chrome.
83+
*
84+
* These do NOT all drop off as kinds get canonical views, which an earlier
85+
* version of this note claimed: the `Embedded*Actions` members are tab chrome
86+
* (open / export buttons), not views, and `EmbeddedFileActions` and
87+
* `EmbeddedInterfaceActions` both outlived their kinds' migrations —
88+
* `EmbeddedTableActions` outlived table's. Only the content components
89+
* (`EmbeddedWorkflow`, `EmbeddedFolder`, `EmbeddedScheduledTask`,
90+
* `EmbeddedLog`) go. Collapsing the five `*Actions` into one kind-keyed
91+
* component is the real fix and is its own change.
8692
*/
87-
shadowNamedComponents: 12,
93+
shadowNamedComponents: 11,
8894
/**
8995
* R2 — imports that reach past a unit barrel. At its floor: the three
9096
* legitimate deep imports are all `lazy()` code-split points, listed in

0 commit comments

Comments
 (0)