#442 Memoize and code-split the ActivityTimeline so its sample data a…#456
Merged
Conversation
…mple data and CSS leave the Trust chunk FIXED
Contributor
Author
|
@Baskarayelu PLEASE REVIEW.... AND PING ME BACK |
|
@felladaniel36-hash Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Closed
4 tasks
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.
FINDINGS
Root Cause
The
ACTIVITY_ITEMSconstant (andSAMPLE_ACTIVITY) along with the fullActivityTimeline.tsx+ActivityTimeline.csswere statically imported directly intoTrustScore.tsx(and also used inDashboard.tsx+Attestations.tsx).This caused the entire timeline component + its styling to be bundled into the initial route chunk, even though the timeline is a secondary, scroll-into-view surface (recent-activity panel).
Impact
Context Alignment
The timeline is slated for both the Trust Score recent-activity panel and a dedicated Attestations route, making lazy loading + memoization critical for performance.
FIX FEATURES IMPLEMENTED
src/data/activity.tsand movedSAMPLE_ACTIVITY,ACTIVITY_ITEMS,ActivityItem, andActivityTonethereActivityRowas a separate component insideActivityTimeline.tsxand wrapped it withReact.memoTrustScore.tsx(the primary consuming surface):const LazyActivityTimeline = lazy(() => import('../components/ActivityTimeline'))Wrapped with
<Suspense>ActivityTimeline.tsx+ its CSS are now split into a separate chunk and only loaded when the panel renders.Suspenseboundary that matches the timeline layout (header + 3 rows)useReducedMotionhook (same pattern asLoadingSkeleton.tsx)prefers-reduced-motion: reduce.items→ immediately showsEmptyState- Chunk failure → covered by existing
ErrorBoundary- Skeleton only shown during actual chunk load
itemsprop, defaultACTIVITY_ITEMS,compactprop, empty state, tone classes, expand/collapse behavior all unchangedErrorBoundarypattern (already wrapping routes)BEFORE vs AFTER IMPACT
TrustScorechunkActivityTimeline-*.js+.cssReact.memo(ActivityRow)Build evidence (from
npm run build):dist/assets/ActivityTimeline-DJOtewtF.js(2.78 kB)dist/assets/ActivityTimeline-BUviJIQi.css(3.75 kB)dist/assets/activity-BIwCDQbB.jsSUMMARY
This fix completely addresses the issue description:
React.lazy+SuspenseLoadingSkeletonfallback matching the timeline layoutActivityRowextracted and wrapped withReact.memoErrorBoundarypatterns in the repoResult: The Trust Score initial paint is now leaner, and the timeline only loads when the user scrolls to the recent-activity panel.
CLOSES #442