Skip to content

Conversation

@shahzadaziz
Copy link
Contributor

@shahzadaziz shahzadaziz commented Dec 31, 2025

Summary

Adds deferDataFetch prop support to defer sidebar panel API calls until preview loads. File metadata is always fetched immediately (needed for sidebar structure), while heavier panel data (activity feed, comments, tasks, versions) is deferred when the prop is true.

Changes made.

  • ContentSidebar.js - Always fetch file metadata on mount (fast, needed for sidebar structure); removed deferDataFetch check from componentDidMount/componentDidUpdate; passes prop through to Sidebar

  • Sidebar.js / SidebarPanels.js - Prop drilling: passes deferDataFetch through to LoadableActivitySidebar
    ActivitySidebar.js - Honors deferDataFetch prop: skips fetchFeedItems() on mount when true; fetches when prop changes from true → false (deferral lifted)

  • ActivitySidebar.test.js - Added tests covering: deferred mount behavior, non-deferred mount, and componentDidUpdate transitions for deferral state changes

@shahzadaziz shahzadaziz requested review from a team as code owners December 31, 2025 00:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

Walkthrough

A new deferDataFetch prop is cascaded through the sidebar component hierarchy (ContentSidebar → Sidebar → SidebarPanels → ActivitySidebar) to conditionally defer initial activity data fetching, allowing preview loading prioritization. ActivitySidebar implements the deferral logic with conditional fetch on mount and resumed fetch when the prop changes. Unit tests verify the behavior.

Changes

Cohort / File(s) Summary
Prop Propagation Chain
src/elements/content-sidebar/ContentSidebar.js, src/elements/content-sidebar/Sidebar.js, src/elements/content-sidebar/SidebarPanels.js
Added deferDataFetch?: boolean prop to component type definitions and wired it through render destructuring and child prop passing to enable downstream consumption.
Deferred Fetch Logic
src/elements/content-sidebar/ActivitySidebar.js
Introduced deferDataFetch?: boolean prop and conditional logic: componentDidMount skips fetchFeedItems when deferDataFetch is true; componentDidUpdate triggers fetch when prop transitions from true to false.
Test Coverage
src/elements/content-sidebar/__tests__/ActivitySidebar.test.js
Added unit tests verifying fetchFeedItems invocation behavior in both componentDidMount and componentDidUpdate across deferral state transitions.

Sequence Diagram

sequenceDiagram
    participant User
    participant ContentSidebar
    participant ActivitySidebar
    participant FetchService
    
    User->>ContentSidebar: Mount with deferDataFetch=true
    ContentSidebar->>ActivitySidebar: Pass deferDataFetch=true
    ActivitySidebar->>ActivitySidebar: componentDidMount<br/>(deferDataFetch=true)
    Note over ActivitySidebar: Skip fetchFeedItems
    
    User->>ContentSidebar: Update deferDataFetch to false
    ContentSidebar->>ActivitySidebar: Pass deferDataFetch=false
    ActivitySidebar->>ActivitySidebar: componentDidUpdate<br/>(deferDataFetch: true→false)
    rect rgb(200, 220, 250)
        Note over ActivitySidebar: Deferral lifted
        ActivitySidebar->>FetchService: fetchFeedItems(true)
        FetchService-->>ActivitySidebar: Activity data
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

ready-to-merge

Suggested reviewers

  • bfoxx1906
  • tjuanitas
  • jpan-box

Poem

🐰 A prop hops down the sidebar chain,
Deferring fetches to ease the strain,
Preview loads first, bright and keen,
When ready, activity's seen!
bounce bounce

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(content-sidebar): add ability to defer sidebar data fetching requests' clearly and concisely describes the main feature being added—deferring sidebar data fetching—and matches the changeset perfectly.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The pull request description comprehensively documents the changes, motivation, and files modified, following the repository's structural guidelines.
✨ Finishing touches
  • 📝 Generate docstrings

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.

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.

2 participants