You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Sidebar collapse does not survive reload — sidebar_state cookie is written but never read back (SidebarProvider always starts from defaultOpen = true) #4234
setOpen writes it on every toggle: document.cookie = ... (~line 101). That is the only occurrence of the cookie name in the whole package.
SidebarProvider initialises from the prop default: defaultOpen = true → const [_open, _setOpen] = React.useState(defaultOpen). There is no cookie read, no lazy initialiser, no hydration effect.
No SPA caller passes a cookie-derived defaultOpen. The only defaultOpen={false} call sites on main are marketing/demo components in apps/site; the console shell passes nothing, so it gets true every load.
The upstream shadcn original resolves this by reading the cookie in a server component and handing the value down as defaultOpen. A pure SPA has no equivalent of that step — so the fix needs an SPA-side read (a lazy useState initialiser or equivalent that parses document.cookie on mount), not merely "pass the prop". Passing a prop from the console shell alone still leaves every other SPA consumer broken.
Verified still present on objectui origin/main @ bb68488 (current at filing time), not just on the vendored console 09987b68 the run used.
Honest contrast — the rest of shell-nav-personalization is healthy
This is a narrow defect, not a broken persistence layer:
Pins, favorites and recents all persist correctly, backed by real sys_user_preference rows.
Reorder is blocked — not failing, untestable: no drag affordance is rendered at all.
Recents capture record visits but not object-list visits.
Confirm the cookie: sidebar_state=false, max-age 7 days.
Reload the page.
Confirm the cookie is stillsidebar_state=false.
Measure the sidebar at +2s, +4s and +8s after load.
Observed: 255px and data-state=expanded at all three sample points. Reproduced 3×.
Dedup
Searched objectstack-ai/objectui for sidebar_state, SidebarProvider, defaultOpen, and sidebar-collapse-not-persisted symptoms — no open or closed duplicate found.
Source
Extracted from the QA run objectstack-ai/objectstack#7514 (framework a86db175, vendored console 09987b6). Root-cause re-verification is against objectui origin/main @ bb68488.
apps/site SSR 水合注记处理正确:按裁决实现(cookie 压 defaultOpen),把 Next SSR 下"访客切换过 demo 侧栏后刷新会有一次 React 自纠水合差异"的后果如实写进 PR——两个替代方案分别违反首帧判据与裁决本身,不擅自偏离而是标记,正是想要的形状。console(本卡报告面)是纯 SPA 无此窗口。
Activity
yinlianghui commentedon Aug 11, 2026
CLAIM + 代决 — session
session_017Qqyix2QcnpUC9XeYVDzx3(objectui whole-repo PM seat;否决窗口开放)。Branch:claude/issue-4234-sidebar-cookie-read。按卡片结论执行(SPA 侧读取,不是只传 prop——单改 console shell 会留下其余 SPA 消费者继续坏),附两条裁决:
openprop > cookie(用户已持久化的选择)>defaultOpenprop >true。cookie 覆盖的是"默认值",不覆盖受控用法;显式defaultOpen={false}的营销 demo 在 cookie 缺席时行为不变(对照 pin)。sidebar.tsx是 sync 面(shadcn-sync 的 registry 请求没有超时:连接被黑洞时pnpm shadcn:check会一直挂着(46 次串行请求) #4031 语境)。dev 先实测shadcn:check如何对待本地分歧(逐字比对?分歧登记?),照仓库既有的"有意分歧"模式落地;若该文件须保持 pristine,则把读取做进 components 包内所有 SPA 消费者共用的薄封装——但绝不允许"只修 console 一个调用点"的形状。核心 pin(红先):cookie
sidebar_state=false在场 ⇒ 首帧 collapsed(QA 的 3× 复现变红先用例);cookie 缺席 ⇒defaultOpen语义逐字不变(对照);写侧(每次 toggle 写 cookie)不回归。Surface:
packages/components/src/ui/sidebar.tsx+ 测试;components 包当前无在飞持有者(#4040 批次2 在 plugin-grid/plugin-form/i18n,#4292/#4240/#4265 均不相交)。Generated by Claude Code
yinlianghui commentedon Aug 11, 2026
ACCEPT — PM review of record (session
session_017Qqyix2QcnpUC9XeYVDzx3)。PR #4312 验收要点:
shadcn-local-patches.mjs声明式补丁注册表 + payload 必须出src/ui/+ 离线执法测试 + 上游失配自动开单),并完整照办——解析逻辑全在 sync 永不再生的lib/sidebar-cookie.ts,sidebar.tsx只加两行锚定补丁并入注册表,pnpm shadcn:update会重放而非静默回滚。补丁注册表门自己也进了红先验证(revert 后该门变红),修复受保护这件事本身有证据。Flipping ready + auto-merge。
Generated by Claude Code
fix(components): SidebarProvider reads back the sidebar_state cookie …