Skip to content

serializeAdminCollectionCookie

serializeAdminCollectionCookie(value): string

Defined in: packages/core/src/adminCookie.ts:307

Serializes AdminCookieCollection to its cookie value. localViews entry NAMES longer than ADMIN_COOKIE_LOCAL_VIEW_NAME_MAX_CHARS code points are truncated via truncateLocalViewName (not dropped — a first-paint tab label has no use for more than 40 characters anyway, and trimming it buys back space without losing a real saved view’s own first-paint tab entirely). rowCounts is NOT re-capped here — the caller (the react writer’s writeListViewSkeletonRowCountCookie) already runs applyListViewSkeletonRowCountUpdate (which enforces LIST_VIEW_SKELETON_ROW_COUNT_COOKIE_MAX_ENTRIES) before this is ever called, the same “cap on write, not on serialize” split the pre-consolidation cookie already used.

If the result still exceeds ADMIN_COOKIE_MAX_BYTES, rowCounts is dropped entirely first (cosmetic — the skeleton falls back to a pageSize guess), then the OLDEST localViews entries one at a time (insertion order) until the serialized value fits, or localViews is empty.

Omit<AdminCookieCollection, "v">

The value to serialize. v is forced to 1 regardless of what’s passed.

string

The JSON string to assign as the cookie’s value, guaranteed to serialize at or under ADMIN_COOKIE_MAX_BYTES.