feat(widget): merge home widget with its pinned widget - #2324
Open
requilence wants to merge 1 commit into
Open
Conversation
When the space homepage points at an object that is also pinned as a widget, the sidebar showed it twice: the standalone home link row at the top of the Pin section, plus the pinned widget itself. The pinned widget now carries the red home icon and the standalone row is suppressed. The widget keeps its user-chosen drag position, and its context menu gains "Change Home", opening the same picker as elsewhere. Also fixes the home row disappearing entirely when nothing was pinned: the row renders inside the Pin section's items, and that section was only emitted when at least one widget was pinned. The home-change action is gated on canModerate to match the same control in Space settings, which is owner/admin only. WidgetHome's own right-click menu gets the same gate, so the action doesn't appear or disappear for a Writer depending on whether the homepage happens to be pinned. The home id is resolved once by the sidebar and passed down as a prop rather than read per widget, so widgets don't each subscribe to the whole spaceview record and re-render on unrelated detail writes. JS-9846
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes JS-9846. Desktop counterpart of DROID-4467, scoped to the sidebar widget panel.
Problem
When the space homepage points at a real object and that object is also pinned as a widget, the sidebar shows it twice — the standalone home link row at the top of the Pin section, plus the pinned widget itself.
Separately: with a homepage set but zero pinned widgets, the home row disappeared entirely. It renders inside the Pin section's items, and that section was only emitted when
pinned.lengthwas non-zero (added in 14114a8 to hide an empty section header — it took the home row down with it).Links view already merged the two via
getWidgetObjects(widgets, isLinksView). This brings Widgets view to parity, keeping the widget rather than flattening it to a link row.Changes
U.Space.getHomeObject()/isHomeObject()— the homepage only when it points at a real object. TheisOneToOneguard is not redundant withisSystemDashboard: in 1-on-1 spacesgetDashboard()returns the chat, whose id is the workspace id, whichisSystemDashboardnever matches.settings/homeicon instead of its object icon. It keeps its drag position — no hoisting to the top.WidgetHomerow is suppressed when the homepage is pinned.U.Menu.dashboardSelectis split intodashboardSelectData()+ a thin opener so the picker can be used both as a top-level menu and as a submenu.Scoped deliberately to the Pin section — a homepage object in My Favorites keeps its plain icon. Links view is untouched.
Review-driven fixes
An Opus review agent caught three things worth calling out:
getWidgetObjects(widgets, true). That flag'swithHomebranch resolves the homepage withgetDashboard(), notgetHomeObject(), so in a 1-on-1 space it injects the chat andpinned.length >= 1becomes unconditional — every 1:1 space would grow a Pin section with a "Chat" row that is hidden today. Replaced withif (pinned.length || (home && !isHomePinned)), which also closes a window where the section could render empty while the home object is still resolving in thewidgetsroot.canEdit(writer, admin, owner), but the same control in Space settings requirescanModerate— owner/admin only. Both the new item andWidgetHome's pre-existing right-click menu are nowcanModerate-gated, so the action doesn't appear or disappear for a Writer depending on whether the homepage happens to be pinned.isHomeObjectper widget made every widget observe the whole spaceview record, so any detail write on it (sync status, space order, push settings) re-rendered the entire list — undoing the stable-block/stable-getObjectmemo caching the sidebar sets up on purpose. The home id is now resolved once by the sidebar and passed down ashomeId.Test plan
bun run typecheckbun run lint— 0 errors; 29 pre-existing warnings, none in the touched files