Skip to content

Comments

[WEB-2007] fix: cycles loading optimization#5207

Merged
SatishGandham merged 6 commits intopreviewfrom
fix/cycles-loading
Jul 23, 2024
Merged

[WEB-2007] fix: cycles loading optimization#5207
SatishGandham merged 6 commits intopreviewfrom
fix/cycles-loading

Conversation

@SatishGandham
Copy link
Contributor

@SatishGandham SatishGandham commented Jul 23, 2024

Summary
Fixed the loading state on active cycle to unblock the independent components

[WEB-2007]

Summary by CodeRabbit

  • New Features

    • Introduced new interfaces to enhance workspace-related data handling.
    • Added methods for retrieving analytics, progress, and lists of active cycles.
    • Enhanced components to handle scenarios where cycle data may be missing, improving user experience.
  • Bug Fixes

    • Improved resilience of various components against null cycle data to prevent runtime errors.
  • Chores

    • Minor formatting adjustments to type definitions for consistency.

@SatishGandham SatishGandham added this to the v0.23-dev milestone Jul 23, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Walkthrough

The 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

Files Change Summary
packages/types/src/cycle/cycle.d.ts, packages/types/src/workspace.d.ts Added IProjectDetails interface and integrated it into ICycle. New workspace response interfaces were also introduced. Minor formatting updates for consistency.
web/core/components/cycles/active-cycle/cycle-stats.tsx, web/core/components/cycles/active-cycle/productivity.tsx, web/core/components/cycles/active-cycle/progress.tsx Changed cycle prop to allow null values in components. Enhanced rendering logic to handle loading states gracefully.
web/core/components/cycles/active-cycle/root.tsx Updated active cycle handling by introducing currentProjectActiveCycle, streamlining state management.
web/core/services/cycle.service.ts Introduced three new async methods for fetching workspace cycle data, enhancing service capabilities.
web/core/store/cycle.store.ts Added currentProjectActiveCycle property for improved cycle state management in the store.

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
Loading

🐇 In fields so wide and bright,
My code hops with delight!
New cycles dance, old bugs flee,
A project’s tale, now clearer to see.
With interfaces fresh and bright,
Our app now shines, oh what a sight! 🌼


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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2978593 and 3829f40.

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 of IProjectDetails interface looks good.

The IProjectDetails interface is correctly defined with a single property id of type string.


92-92: Integration of IProjectDetails into ICycle looks good.

The project_detail property is correctly added to the ICycle interface.

web/core/components/cycles/active-cycle/root.tsx (2)

31-31: Introduction of currentProjectActiveCycle variable looks good.

The currentProjectActiveCycle variable is correctly introduced from the useCycle hook.


Line range hint 41-83:
Updates to conditional rendering and ActiveCycleStats component look good.

The updates to use currentProjectActiveCycle in the conditional rendering logic and ActiveCycleStats component invocation are correctly done.

web/core/components/cycles/active-cycle/progress.tsx (2)

18-18: Update to cycle prop in ActiveCycleProgressProps looks good.

The cycle prop is correctly updated to allow null values.


Line range hint 27-102:
Addition of conditional checks in ActiveCycleProgress component looks good.

The conditional checks to handle null values for the cycle prop 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 of IWorkspaceActiveCyclesResponse interface.

The interface is well-structured and includes relevant properties for pagination and cycle data.


213-219: Approved: Addition of IWorkspaceProgressResponse interface.

The interface includes essential properties for tracking progress through various issue metrics.


220-222: Approved: Addition of IWorkspaceAnalyticsResponse interface.

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 of workspaceActiveCyclesAnalytics method.

The method constructs a GET request to the appropriate API endpoint and handles responses and errors gracefully.


33-43: Approved: Addition of workspaceActiveCyclesProgress method.

The method constructs a GET request to the designated endpoint and processes the response or any potential errors.


45-60: Approved: Addition of workspaceActiveCycles method.

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 in ActiveCycleProductivityProps type.

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 cycle is 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 cycle to be null enhances the component's ability to handle incomplete or absent cycle data.


34-34: LGTM! Adding cycleId enhances flexibility.

The introduction of the optional cycleId property provides a fallback mechanism to fetch cycle-related data when the cycle object is null.


38-38: LGTM! Destructuring cycleId from props.

Destructuring cycleId from props ensures it is readily available for use within the component.


67-68: LGTM! Updating useSWR to use cycleId.

The update to use cycleId instead of cycle.id ensures that data fetching works correctly even when cycle is null.


72-72: LGTM! Checking for cycleId before retrieving cycle issue details.

The retrieval of cycleIssueDetails now checks for cycleId, defaulting to an empty object if cycleId is not present, ensuring robustness.


75-75: LGTM! Preventing loadMoreIssues execution without cycleId.

The loadMoreIssues function is updated to prevent execution if cycleId is not provided, enhancing robustness against potential errors.


165-165: LGTM! Checking for cycleId before rendering UI components.

The rendering logic now consistently checks for the presence of cycleId before rendering relevant UI components, preventing potential errors.


240-240: LGTM! Checking for cycleId before rendering loaders.

The rendering logic now consistently checks for the presence of cycleId before rendering loaders, preventing potential errors.

web/core/store/cycle.store.ts (4)

35-35: LGTM! Adding currentProjectActiveCycle enhances state management.

The addition of currentProjectActiveCycle of type ICycle | null to the ICycleStore interface enhances the data structure to accommodate the active cycle associated with the current project.


105-106: LGTM! Implementing currentProjectActiveCycle as a computed property.

The implementation of currentProjectActiveCycle as 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 currentProjectActiveCycle computed 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 returning null.


240-240: LGTM! Properly closing the computed property.

The currentProjectActiveCycle computed property is correctly closed and integrated within the CycleStore class.

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