feat(content-sidebar): add ability to defer sidebar data fetching requests #4410
+91
−1
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.
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