Skip to content

refactor(web): shrink LayoutShell.documentsPanel interface (fixes #1360)#1436

Merged
MODSetter merged 1 commit into
MODSetter:devfrom
suryo12:refactor/1360-shrink-documents-panel-interface
May 26, 2026
Merged

refactor(web): shrink LayoutShell.documentsPanel interface (fixes #1360)#1436
MODSetter merged 1 commit into
MODSetter:devfrom
suryo12:refactor/1360-shrink-documents-panel-interface

Conversation

@suryo12
Copy link
Copy Markdown
Contributor

@suryo12 suryo12 commented May 25, 2026

Removes the dead isDocked / onDockedChange plumbing from LayoutShell.documentsPanel — these fields were declared and populated by LayoutDataProvider but never forwarded by the shell to any consumer, so the interface advertised a capability it never delivered.

Description

  • components/layout/ui/shell/LayoutShell.tsx — Trims the documentsPanel prop type to the two fields the shell actually plumbs through (open, onOpenChange). RightPanel already declares its own interface restricted to those two fields, and DocumentsSidebar keeps the docking props on its own optional interface for the few callers that wire them directly.
  • components/layout/providers/LayoutDataProvider.tsx — Drops the isDocumentsDocked / setIsDocumentsDocked useState pair and the matching isDocked / onDockedChange entries in the documentsPanel prop, since the shell never read them downstream. FreeLayoutDataProvider was already passing the minimal pair, so it needs no change.
  • components/layout/ui/sidebar/DocumentsSidebar.tsx — Left untouched per the issue notes. Its docking props remain optional so any direct caller that does want to drive docking can still do so without the shell as a middleman.

Motivation and Context

The previous interface advertised four fields, but LayoutShell only ever forwarded two. New contributors reading the type would expect the shell to drive a docking flow that it doesn't, and the data provider was carrying a useState that nothing else in the tree consumed. Tightening the contract makes the shell's actual capability self-documenting and removes a dead plumbing path.

FIX #1360

Screenshots

N/A — type / dead-code cleanup, no UI change.

API Changes

  • This PR includes API changes

Change Type

  • Refactoring

Testing Performed

  • pnpm exec biome check ./components/layout/ui/shell/LayoutShell.tsx ./components/layout/providers/LayoutDataProvider.tsx passes.

  • pnpm exec tsc --noEmit introduces no new type errors in the touched files. Verified there are no other callers of LayoutShell passing isDocked / onDockedChange (grep -r across surfsense_web/ returned only the two files above plus DocumentsSidebar's own internal prop definitions, which are untouched).

  • Runtime behaviour is unchanged: LayoutShell never read the removed fields, so removing them in the data provider has no downstream effect.

  • Tested locally

  • Manual/QA verification

Checklist

  • Follows project coding standards and conventions
  • Documentation updated as needed
  • Dependencies updated as needed
  • No lint/build errors or new warnings
  • All relevant tests are passing

High-level PR Summary

This PR cleans up dead code by removing unused docking-related props (isDocked and onDockedChange) from the LayoutShell.documentsPanel interface. The shell component never forwarded these fields to any consumers, so the interface was advertising a capability it didn't actually deliver. The changes remove the unused state management from LayoutDataProvider and tighten the interface definition in LayoutShell to only include the two props that are actually used (open and onOpenChange).

⏱️ Estimated Review Time: 5-15 minutes

💡 Review Order Suggestion
Order File Path
1 surfsense_web/components/layout/ui/shell/LayoutShell.tsx
2 surfsense_web/components/layout/providers/LayoutDataProvider.tsx

Need help? Join our Discord

…Setter#1360)

The `documentsPanel` prop on `LayoutShell` declared `isDocked` and
`onDockedChange` alongside `open` / `onOpenChange`, but the shell never
forwarded those two extra fields to its consumers. `RightPanel` already
defines its own interface accepting only `open` / `onOpenChange`, and
`DocumentsSidebar` keeps both as optional props with safe fallbacks for
the rare cases that pass them directly.

Trim the interface to the two fields the shell actually plumbs through
and drop the matching `isDocumentsDocked` state and prop entries from
`LayoutDataProvider`, which was the only caller still populating the
dead fields (`FreeLayoutDataProvider` already passed the minimal pair).
`DocumentsSidebar` itself is untouched — its props remain optional so
direct consumers that want docking behaviour can still wire it.
Copilot AI review requested due to automatic review settings May 25, 2026 15:10
@vercel
Copy link
Copy Markdown

vercel Bot commented May 25, 2026

@suryo12 is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 46ad60f3-9b55-467c-96aa-1a1f474d08e2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Removes the “docked documents” concept from the layout layer, simplifying the Documents panel state/props.

Changes:

  • Dropped isDocked / onDockedChange from LayoutShellProps.documentsPanel.
  • Removed isDocumentsDocked state in LayoutDataProvider and stopped passing dock-related props downstream.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
surfsense_web/components/layout/ui/shell/LayoutShell.tsx Removes dock-related fields from the documentsPanel prop contract.
surfsense_web/components/layout/providers/LayoutDataProvider.tsx Removes local dock state and stops supplying dock props to LayoutShell.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 128 to 132
// Documents sidebar state (shared atom so Composer can toggle it)
const [isDocumentsSidebarOpen, setIsDocumentsSidebarOpen] = useAtom(documentsSidebarOpenAtom);
const [isDocumentsDocked, setIsDocumentsDocked] = useState(true);
const setIsRightPanelCollapsed = useSetAtom(rightPanelCollapsedAtom);

// Open documents sidebar by default on desktop (docked mode)
@MODSetter MODSetter merged commit e1abbf7 into MODSetter:dev May 26, 2026
5 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants