[WEB-2007] fix: cycles loading optimization#5207
Conversation
WalkthroughThe recent updates enhance the TypeScript definitions and components related to cycles and workspaces, introducing new interfaces and improving existing ones. Key modifications include the addition of project details within cycles, refined type handling for components, and new service methods for workspace analytics and progress. These changes collectively improve data management and user experience while maintaining code consistency and robustness. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CycleService
participant CycleStore
participant Component
User->>Component: Request active cycle data
Component->>CycleStore: Get currentProjectActiveCycle
CycleStore->>CycleService: Fetch active cycles
CycleService-->>CycleStore: Return cycle data
CycleStore-->>Component: Provide active cycle
Component-->>User: Display active cycle information
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (8)
- packages/types/src/cycle/cycle.d.ts (4 hunks)
- packages/types/src/workspace.d.ts (3 hunks)
- web/core/components/cycles/active-cycle/cycle-stats.tsx (5 hunks)
- web/core/components/cycles/active-cycle/productivity.tsx (4 hunks)
- web/core/components/cycles/active-cycle/progress.tsx (4 hunks)
- web/core/components/cycles/active-cycle/root.tsx (4 hunks)
- web/core/services/cycle.service.ts (1 hunks)
- web/core/store/cycle.store.ts (4 hunks)
Additional comments not posted (29)
packages/types/src/cycle/cycle.d.ts (2)
64-66: Addition ofIProjectDetailsinterface looks good.The
IProjectDetailsinterface is correctly defined with a single propertyidof typestring.
92-92: Integration ofIProjectDetailsintoICyclelooks good.The
project_detailproperty is correctly added to theICycleinterface.web/core/components/cycles/active-cycle/root.tsx (2)
31-31: Introduction ofcurrentProjectActiveCyclevariable looks good.The
currentProjectActiveCyclevariable is correctly introduced from theuseCyclehook.
Line range hint
41-83:
Updates to conditional rendering andActiveCycleStatscomponent look good.The updates to use
currentProjectActiveCyclein the conditional rendering logic andActiveCycleStatscomponent invocation are correctly done.web/core/components/cycles/active-cycle/progress.tsx (2)
18-18: Update tocycleprop inActiveCycleProgressPropslooks good.The
cycleprop is correctly updated to allownullvalues.
Line range hint
27-102:
Addition of conditional checks inActiveCycleProgresscomponent looks good.The conditional checks to handle
nullvalues for thecycleprop are correctly added.packages/types/src/workspace.d.ts (4)
50-50: Approved: Formatting change enhances consistency.The removal of spaces in the object type declaration improves code consistency without affecting functionality.
202-211: Approved: Addition ofIWorkspaceActiveCyclesResponseinterface.The interface is well-structured and includes relevant properties for pagination and cycle data.
213-219: Approved: Addition ofIWorkspaceProgressResponseinterface.The interface includes essential properties for tracking progress through various issue metrics.
220-222: Approved: Addition ofIWorkspaceAnalyticsResponseinterface.The interface includes a property for the completion chart, which is crucial for analytics.
web/core/services/cycle.service.ts (4)
2-9: Approved: Import statement changes.The import statement has been expanded to include new types necessary for the return types of the new methods.
18-31: Approved: Addition ofworkspaceActiveCyclesAnalyticsmethod.The method constructs a GET request to the appropriate API endpoint and handles responses and errors gracefully.
33-43: Approved: Addition ofworkspaceActiveCyclesProgressmethod.The method constructs a GET request to the designated endpoint and processes the response or any potential errors.
45-60: Approved: Addition ofworkspaceActiveCyclesmethod.The method constructs a GET request and manages the response and errors in a manner consistent with the other new methods.
web/core/components/cycles/active-cycle/productivity.tsx (3)
18-18: Approved: Change inActiveCycleProductivityPropstype.The change allows for more flexible handling when the cycle data is not available.
54-55: Approved: Update to derived values logic.The update prevents potential runtime errors by ensuring that
cycleis present before accessing its properties.
139-142: Approved: Update to rendering logic.The update enhances user experience by providing visual feedback when data is not yet available.
web/core/components/cycles/active-cycle/cycle-stats.tsx (8)
33-33: LGTM! Handling null cycles improves robustness.The update to allow
cycleto benullenhances the component's ability to handle incomplete or absent cycle data.
34-34: LGTM! AddingcycleIdenhances flexibility.The introduction of the optional
cycleIdproperty provides a fallback mechanism to fetch cycle-related data when thecycleobject isnull.
38-38: LGTM! DestructuringcycleIdfrom props.Destructuring
cycleIdfrom props ensures it is readily available for use within the component.
67-68: LGTM! UpdatinguseSWRto usecycleId.The update to use
cycleIdinstead ofcycle.idensures that data fetching works correctly even whencycleisnull.
72-72: LGTM! Checking forcycleIdbefore retrieving cycle issue details.The retrieval of
cycleIssueDetailsnow checks forcycleId, defaulting to an empty object ifcycleIdis not present, ensuring robustness.
75-75: LGTM! PreventingloadMoreIssuesexecution withoutcycleId.The
loadMoreIssuesfunction is updated to prevent execution ifcycleIdis not provided, enhancing robustness against potential errors.
165-165: LGTM! Checking forcycleIdbefore rendering UI components.The rendering logic now consistently checks for the presence of
cycleIdbefore rendering relevant UI components, preventing potential errors.
240-240: LGTM! Checking forcycleIdbefore rendering loaders.The rendering logic now consistently checks for the presence of
cycleIdbefore rendering loaders, preventing potential errors.web/core/store/cycle.store.ts (4)
35-35: LGTM! AddingcurrentProjectActiveCycleenhances state management.The addition of
currentProjectActiveCycleof typeICycle | nullto theICycleStoreinterface enhances the data structure to accommodate the active cycle associated with the current project.
105-106: LGTM! ImplementingcurrentProjectActiveCycleas a computed property.The implementation of
currentProjectActiveCycleas a computed property ensures that the active cycle is dynamically retrieved based on the current project's ID, improving state management.
235-239: LGTM! Retrieving active cycle based on project ID.The
currentProjectActiveCyclecomputed property retrieves the active cycle based on the current project's ID, handling cases where the project ID or active cycle ID is absent by returningnull.
240-240: LGTM! Properly closing the computed property.The
currentProjectActiveCyclecomputed property is correctly closed and integrated within theCycleStoreclass.
Summary
Fixed the loading state on active cycle to unblock the independent components
[WEB-2007]
Summary by CodeRabbit
New Features
Bug Fixes
Chores