Repository navigation
Replies: 1 comment
|
The width setter already exists one layer down; what is missing is persistence, and a public way to reach it.
/** Saved right panel width in px, or null before its first opening. ... */
rightbar: number | nulland the action is setRightbar: (d, px: number) => {
d.layoutInfo.rightbarInstant = false
d.layoutInfo.rightbar = clampWidth(px, RIGHTBAR_MIN, Math.max(RIGHTBAR_MIN, d.layoutInfo.viewportWidth * RIGHTBAR_MAX_RATIO))
},So the store can already store a width, and What lags is the service: the The persistence half needs a decision about which fields deserve it. One caveat if you patch this locally: |
Uh oh!
There was an error while loading. Please reload this page.
Problem
Dragging the right sidebar to a custom width works fine within a session, but the width resets to the default ratio after every app restart.
Root cause (verified against 0.2.1-rc.2)
The right panel width lives in
layoutInfo.rightbar, created bycreateLayoutStore()inpackages/client/ui-layout/src/client/stores.tsas a pure in-memory store:rightbar: null;openRightbar()fills it withmax(RIGHTBAR_MIN, viewport * RIGHTBAR_DEFAULT_RATIO)on first open.dsh-client-ui-layoutclient bundle has zero references tolocalStorage/sessionStorage/ any persistence layer, so the width cannot survive a restart.rightbarPreference→rightbarMax→ the frame's inlinegrid-template-columnsthird track, and thewidthpassed to therightbarslot (the panel renders at the slot width, hanging off the column's right edge). DOM-level workarounds (CSS overrides, rewriting the grid track) cannot restore the visual width and actively break the layout — we tried.Why this matters
Panel geometry is basic window-chrome state. Users reasonably expect it to persist across restarts, and right-sidebar-occupying plugins (e.g.
dsh-better-sidebar) cannot fix this from their side.Requests
layoutInfo.rightbaracross restarts — e.g. via the profile settings service or a small state file, applying the existing[RIGHTBAR_MIN, viewport * RIGHTBAR_MAX_RATIO]clamp on restore.layoutclient service. TodayILayout(ctx.layout) only offersopenRightbar/closeRightbar/toggleSidebar/selectPanel. Plugin authors who want to restore or adjust the width must reach into the private runtime propertyLayoutController.panels(the bound store actions) and callpanels.setRightbar(px)— which works today only because the bundle preserves that property name, and can break in any refactor or minification change.Current workaround (for reference)
We built a local plugin (
dsh-rightbar-memory) with a host route persisting the width to JSON, and a client half that:ctx.layout.panels.setRightbar(savedWidth)(the private-property reliance from request 2), anddata-dragging, POSTing the dragged value (debounced, flushed on pointerup).It works, but both halves would be unnecessary if the two requests above were supported natively. Happy to share details or help test a PR.
All reactions