Skip to content

truncateLocalViewName

truncateLocalViewName(name): string

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

Truncates a local view’s NAME to ADMIN_COOKIE_LOCAL_VIEW_NAME_MAX_CHARS code points (not UTF-16 code units — never splits a surrogate pair), or returns it unchanged when already at or under the cap. The SAME function backs both sides of the zero-shift guarantee a long local-view name needs (developer-reported): serializeAdminCollectionCookie (what the server reads back out of the cookie for SSR) and @vexcms/react’s own local-view TAB LABEL render (what localStorage’s full, untruncated name displays as once hydrated) both call this ONE function, so a name over the cap renders identically before and after hydration — never a from-truncated to-full flash. Only the TAB LABEL is capped this way; the view’s own name field (the rename dialog’s seed, the view-switcher list, etc.) always uses the full, untruncated localStorage value — this function is never applied there.

string

The local view’s full name.

string

name, or its first ADMIN_COOKIE_LOCAL_VIEW_NAME_MAX_CHARS code points.