Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-2114]: Chore: project cycle optimization #5430

Merged
merged 12 commits into from
Aug 27, 2024

Conversation

gakshita
Copy link
Collaborator

@gakshita gakshita commented Aug 26, 2024

Summary
Backend Change: Split the cycles api into /progress and /analytics
Frontend Change: Made integrational changes to incorporate the backend changes

[WEB-2114]

Summary by CodeRabbit

  • New Features

    • Introduced two new API endpoints for cycle progress and analytics, enhancing data retrieval capabilities.
    • Added support for detailed cycle issue information in the ActiveCycleStats component.
    • Implemented methods to fetch active cycle progress and analytics in the CycleStore for improved data management.
  • Improvements

    • Streamlined data fetching logic in several components, improving readability and maintainability.
    • Enhanced the ActiveCycleProgress component to better handle cycle data and rendering conditions.
    • Updated observable properties in the CycleStore for more dynamic and responsive state management.
    • Consolidated state management in the ActiveCycleRoot component through a new custom hook.
    • Improved user feedback during data loading scenarios in the CycleAnalyticsProgress component.
  • Bug Fixes

    • Improved error handling and loading state management across components for a better user experience.

Copy link
Contributor

coderabbitai bot commented Aug 26, 2024

Walkthrough

The changes introduced multiple new API endpoints for cycle progress and analytics, streamlining data retrieval and management. A custom hook was created to simplify cycle detail fetching, while existing components were refactored to enhance state management and improve code clarity. Additionally, type definitions were refined for better type safety, and new methods were added to the CycleStore to facilitate fetching active cycle data.

Changes

File(s) Change Summary
apiserver/plane/app/urls/cycle.py, apiserver/plane/app/views/__init__.py, apiserver/plane/app/views/cycle/base.py Added CycleProgressEndpoint and CycleAnalyticsEndpoint, enhancing API functionality for cycle-related data retrieval.
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/page.tsx, web/core/components/cycles/active-cycle/use-cycles-details.ts Refactored cycle detail fetching using a new custom hook, improving code clarity and separation of concerns.
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, web/core/components/cycles/active-cycle/root.tsx Updated props and rendering logic for components to improve handling of cycle data and streamline state management.
web/core/services/cycle.service.ts, web/core/store/cycle.store.ts Modified return types for service methods and added new methods for fetching cycle progress and analytics, enhancing type safety and data handling capabilities.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CycleDetailPage
    participant useCyclesDetails
    participant CycleService
    participant CycleStore

    User->>CycleDetailPage: Request Cycle Details
    CycleDetailPage->>useCyclesDetails: Fetch Cycle Data
    useCyclesDetails->>CycleService: Call API for Cycle Data
    CycleService-->>useCyclesDetails: Return Cycle Data
    useCyclesDetails-->>CycleDetailPage: Provide Cycle Data
    CycleDetailPage-->>User: Display Cycle Details
Loading

🐇 In the meadow, cycles spin,
New paths of progress we begin.
With data flowing, bright and clear,
Analytics dance, bring us cheer.
Hop along, the code does sing,
A joyful change, let the rabbits spring! 🌼


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: 1

Outside diff range, codebase verification and nitpick comments (1)
web/core/components/cycles/active-cycle/productivity.tsx (1)

Line range hint 1-49: Consider re-adding loading feedback.

The removal of the useState hook and fetchCycleDetails function simplifies the component but may impact user experience by not providing loading feedback during data fetching. Consider re-adding some form of loading feedback to enhance user experience.

Tools
Biome

[error] 40-40: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4689ebe and 7249c72.

Files selected for processing (11)
  • apiserver/plane/app/urls/cycle.py (2 hunks)
  • apiserver/plane/app/views/init.py (1 hunks)
  • apiserver/plane/app/views/cycle/base.py (11 hunks)
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/[cycleId]/page.tsx (3 hunks)
  • web/core/components/cycles/active-cycle/cycle-stats.tsx (7 hunks)
  • web/core/components/cycles/active-cycle/productivity.tsx (4 hunks)
  • web/core/components/cycles/active-cycle/progress.tsx (2 hunks)
  • web/core/components/cycles/active-cycle/root.tsx (4 hunks)
  • web/core/components/cycles/active-cycle/use-cycles-details.ts (1 hunks)
  • web/core/services/cycle.service.ts (3 hunks)
  • web/core/store/cycle.store.ts (7 hunks)
Additional context used
Ruff
apiserver/plane/app/views/__init__.py

101-101: .cycle.base.CycleAnalyticsEndpoint imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


102-102: .cycle.base.CycleProgressEndpoint imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

Additional comments not posted (38)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/cycles/(detail)/[cycleId]/page.tsx (3)

9-9: LGTM!

The new import statement for useCyclesDetails is correct.

The code changes are approved.


33-37: LGTM!

The custom hook useCyclesDetails is correctly invoked with the necessary parameters.

The code changes are approved.


54-54: LGTM!

The conditional rendering logic is correctly implemented and improves the readability of the component.

The code changes are approved.

apiserver/plane/app/urls/cycle.py (3)

9-10: LGTM!

The new import statements for CycleProgressEndpoint and CycleAnalyticsEndpoint are correct.

The code changes are approved.


111-115: LGTM!

The new route for CycleProgressEndpoint is correctly defined.

The code changes are approved.


116-120: LGTM!

The new route for CycleAnalyticsEndpoint is correctly defined.

The code changes are approved.

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

19-19: LGTM!

The new import statement for useCyclesDetails is correct.

The code changes are approved.


31-34: LGTM!

The custom hook useCyclesDetails is correctly invoked with the necessary parameters.

The code changes are approved.


37-37: LGTM!

The conditional rendering logic is correctly implemented and improves the readability of the component.

The code changes are approved.


Line range hint 68-85: LGTM!

The updated props for ActiveCycleProgress, ActiveCycleProductivity, and ActiveCycleStats are correctly passed.

The code changes are approved.

web/core/components/cycles/active-cycle/use-cycles-details.ts (8)

1-8: Import statements look good.

The imports are well-organized and necessary for the functionality of the hook.


10-14: Interface definition is clear.

The IActiveCycleDetails interface is well-defined and provides a clear structure for the expected props.


16-25: Destructuring props and initializing hooks.

The props are correctly destructured, and necessary hooks are initialized. Ensure that useIssues and useCycle hooks are correctly implemented and imported.


27-29: Fetching cycle details using SWR.

The useSWR hooks are used effectively to fetch cycle details. Ensure that fetchActiveCycleProgress, fetchActiveCycleAnalytics, and fetchActiveCycleIssues functions handle errors appropriately.

Verify that the functions handle errors appropriately and return meaningful error messages.


31-56: Fetching cycle details using SWR.

The useSWR hooks are used effectively to fetch cycle details. Ensure that fetchActiveCycleProgress, fetchActiveCycleAnalytics, and fetchActiveCycleIssues functions handle errors appropriately.

Verify that the functions handle errors appropriately and return meaningful error messages.


58-58: Fetching cycle issue details.

The getActiveCycleByIdFromIssue function is used to fetch cycle issue details. Ensure that this function is correctly implemented and handles errors appropriately.

Verify that the function handles errors appropriately and returns meaningful error messages.


60-84: Callback function for updating filters.

The handleFiltersUpdate function is well-implemented and uses useCallback for optimization. Ensure that updateFilters function is correctly implemented and handles errors appropriately.

Verify that the updateFilters function handles errors appropriately and returns meaningful error messages.


85-92: Returning hook values.

The hook returns necessary values and functions, making it easy to use in components.

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

Line range hint 4-21: Import statements and prop types look good.

The imports are well-organized and necessary for the functionality of the component. The prop types are well-defined and provide a clear structure for the expected props.


26-29: Destructuring props and initializing hooks.

The props are correctly destructured, and necessary hooks are initialized. Ensure that useProjectState hook is correctly implemented and imported.


30-45: Derived values and grouped issues.

The derived values and grouped issues are correctly calculated. Ensure that PROGRESS_STATE_GROUPS_DETAILS is correctly defined and imported.


46-46: Component rendering logic.

The component rendering logic is well-implemented and uses isEmpty to handle empty cycle data. This ensures robustness and prevents runtime errors.


47-47: Progress section rendering.

The progress section is correctly rendered based on the cycle data. Ensure that LinearProgressIndicator is correctly implemented and imported.


48-48: Grouped issues rendering.

The grouped issues are correctly rendered based on the cycle data. Ensure that groupedProjectStates is correctly defined and imported.


49-49: Cancelled issues rendering.

The cancelled issues are correctly rendered based on the cycle data.


Line range hint 50-50: Empty state rendering.

The empty state is correctly rendered when there are no issues. Ensure that EmptyState and EmptyStateType are correctly implemented and imported.


Line range hint 51-51: Loader rendering.

The loader is correctly rendered when the cycle data is empty. Ensure that Loader is correctly implemented and imported.

apiserver/plane/app/views/__init__.py (1)

Line range hint 1-100: Import statements look good.

The imports are well-organized and necessary for the functionality of the file.

Tools
Ruff

98-98: .cycle.base.CycleUserPropertiesEndpoint imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


99-99: Redefinition of unused CycleViewSet from line 94

Remove definition: CycleViewSet

(F811)


99-99: .cycle.base.CycleViewSet imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


100-100: Redefinition of unused TransferCycleIssueEndpoint from line 97

Remove definition: TransferCycleIssueEndpoint

(F811)


100-100: .cycle.base.TransferCycleIssueEndpoint imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


101-101: .cycle.base.CycleAnalyticsEndpoint imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


102-102: .cycle.base.CycleProgressEndpoint imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


105-105: .cycle.issue.CycleIssueViewSet imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

web/core/services/cycle.service.ts (2)

Line range hint 24-28: LGTM!

The function is correctly implemented with proper error handling. The updated return type enhances type safety.

The code changes are approved.


Line range hint 38-42: LGTM!

The function is correctly implemented with proper error handling. The updated return type enhances type safety.

The code changes are approved.

web/core/components/cycles/active-cycle/cycle-stats.tsx (1)

Line range hint 4-302: LGTM!

The addition of the cycleIssueDetails prop enhances the component's functionality. The removal of the useSWR hook and streamlined logic improve performance. The adjusted conditional rendering improves robustness.

The code changes are approved.

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

65-71: LGTM!

The new methods fetchActiveCycleProgress and fetchActiveCycleAnalytics are correctly added to the ICycleStore interface.

The code changes are approved.


110-110: Verify the impact of changing plotType to a standard observable.

Changing plotType from observable.ref to observable will affect how changes to this property are tracked and reacted to within the MobX state management framework. Ensure this change doesn't introduce any unintended side effects.


130-131: LGTM!

The new methods fetchActiveCycleProgress and fetchActiveCycleAnalytics are correctly implemented in the CycleStore class. They include logic to update the cycleMap with fetched data, ensuring the state reflects the most current information regarding cycles.

The code changes are approved.

Also applies to: 486-492, 501-514

apiserver/plane/app/views/cycle/base.py (4)

30-30: Verify the impact of reducing complexity in get_queryset.

The reduction in complexity simplifies the logic and reduces potential performance overhead. Ensure that the removal of detailed estimates does not affect any critical functionality.


1008-1143: LGTM!

The new class CycleProgressEndpoint is correctly implemented and enhances the functionality by allowing users to access summarized estimate data directly related to a specific cycle.

The code changes are approved.


1144-1362: LGTM!

The new class CycleAnalyticsEndpoint is correctly implemented and enhances the functionality by allowing users to retrieve analytics based on either points or issues.

The code changes are approved.


412-418: Verify the impact of new annotations in retrieve method.

The new annotations provide additional information about the issues associated with a cycle. Ensure that these changes do not introduce any performance overhead.

Comment on lines +101 to +102
CycleAnalyticsEndpoint,
CycleProgressEndpoint,
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused imports.

The CycleAnalyticsEndpoint and CycleProgressEndpoint are imported but not used in the file. Consider removing them or adding them to __all__.

Apply this diff to remove the unused imports:

-    CycleAnalyticsEndpoint,
-    CycleProgressEndpoint,

Alternatively, if these endpoints are intended to be used elsewhere, add them to __all__:

+__all__ = [
+    ...
+    "CycleAnalyticsEndpoint",
+    "CycleProgressEndpoint",
+]
Tools
Ruff

101-101: .cycle.base.CycleAnalyticsEndpoint imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)


102-102: .cycle.base.CycleProgressEndpoint imported but unused; consider removing, adding to __all__, or using a redundant alias

(F401)

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 7249c72 and 5777ee8.

Files selected for processing (1)
  • web/core/store/cycle.store.ts (6 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/core/store/cycle.store.ts

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 5777ee8 and 94c1262.

Files selected for processing (1)
  • web/core/components/cycles/active-cycle/root.tsx (4 hunks)
Additional comments not posted (8)
web/core/components/cycles/active-cycle/root.tsx (8)

18-18: LGTM!

The import of ActiveCycleIssueDetails is necessary for type definition.

The code changes are approved.


19-19: LGTM!

The import of useCyclesDetails is necessary for the new state management logic.

The code changes are approved.


29-29: LGTM!

The useCycle hook is correctly used to manage the current project active cycle and loader state.

The code changes are approved.


31-34: LGTM!

The useCyclesDetails custom hook is correctly used to manage the cycle details.

The code changes are approved.


37-40: LGTM!

The loader state is correctly checked to show a loader if the active cycle is loading.

The code changes are approved.


68-73: LGTM!

The ActiveCycleProgress component props are correctly updated to enhance integration with the overall state management.

The code changes are approved.


85-85: LGTM!

The ActiveCycleStats component prop is correctly updated to enhance integration with the overall state management.

The code changes are approved.


85-85: LGTM!

The type casting ensures type safety for the cycleIssueDetails prop.

The code changes are approved.

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: 1

Outside diff range, codebase verification and nitpick comments (6)
web/core/components/cycles/active-cycle/root.tsx (2)

16-17: Remove unused import ActiveCycleIssueDetails.

The ActiveCycleIssueDetails import is not used in this file and can be removed to clean up the code.

-import { ActiveCycleIssueDetails } from "@/store/issue/cycle";

75-75: Remove unnecessary type assertion for cycleIssueDetails.

The type assertion as ActiveCycleIssueDetails is unnecessary if the type is already correctly inferred. Remove it to clean up the code.

- cycleIssueDetails={cycleIssueDetails as ActiveCycleIssueDetails}
+ cycleIssueDetails={cycleIssueDetails}
web/core/components/cycles/active-cycle/progress.tsx (3)

25-25: Destructure workspaceSlug and projectId props for consistency.

Destructure workspaceSlug and projectId props along with handleFiltersUpdate and cycle for consistency.

- const { handleFiltersUpdate, cycle } = props;
+ const { handleFiltersUpdate, cycle, workspaceSlug, projectId } = props;

29-29: Use optional chaining for cycle.total_issues.

Use optional chaining to safely access cycle.total_issues to prevent potential runtime errors.

- value: cycle && cycle.total_issues > 0 ? (cycle[group.key as keyof ICycle] as number) : 0,
+ value: cycle?.total_issues > 0 ? (cycle[group.key as keyof ICycle] as number) : 0,

38-41: Use optional chaining for cycle properties.

Use optional chaining to safely access cycle properties to prevent potential runtime errors.

- completed: cycle?.completed_issues,
- started: cycle?.started_issues,
- unstarted: cycle?.unstarted_issues,
- backlog: cycle?.backlog_issues,
+ completed: cycle?.completed_issues ?? 0,
+ started: cycle?.started_issues ?? 0,
+ unstarted: cycle?.unstarted_issues ?? 0,
+ backlog: cycle?.backlog_issues ?? 0,
web/core/components/cycles/analytics-sidebar/issue-progress.tsx (1)

11-11: Remove unused import Spinner.

The Spinner import is not used in this file and can be removed to clean up the code.

- import { CustomSelect, Loader, Spinner } from "@plane/ui";
+ import { CustomSelect, Loader } from "@plane/ui";
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 94c1262 and 20a0e3f.

Files selected for processing (5)
  • web/core/components/cycles/active-cycle/productivity.tsx (4 hunks)
  • web/core/components/cycles/active-cycle/progress.tsx (1 hunks)
  • web/core/components/cycles/active-cycle/root.tsx (4 hunks)
  • web/core/components/cycles/active-cycle/use-cycles-details.ts (1 hunks)
  • web/core/components/cycles/analytics-sidebar/issue-progress.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (2)
  • web/core/components/cycles/active-cycle/productivity.tsx
  • web/core/components/cycles/active-cycle/use-cycles-details.ts
Additional context used
Biome
web/core/components/cycles/active-cycle/progress.tsx

[error] 45-45: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 45-45: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)

Additional comments not posted (6)
web/core/components/cycles/active-cycle/root.tsx (3)

27-27: Ensure proper error handling for useCycle hook.

The useCycle hook is used to get currentProjectActiveCycle and currentProjectActiveCycleId. Ensure that the hook handles errors properly and returns default values if needed.

Ensure that the useCycle hook handles errors and returns default values if needed.


29-32: Ensure proper error handling for useCyclesDetails hook.

The useCyclesDetails hook is used to get handleFiltersUpdate, activeCycle, and cycleIssueDetails. Ensure that the hook handles errors properly and returns default values if needed.

Ensure that the useCyclesDetails hook handles errors and returns default values if needed.


58-63: Ensure ActiveCycleProgress component handles null or undefined cycle prop.

The ActiveCycleProgress component receives cycle as a prop. Ensure that the component handles cases where cycle is null or undefined to prevent runtime errors.

Ensure that the ActiveCycleProgress component handles null or undefined cycle prop.

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

19-20: Ensure workspaceSlug and projectId props are always provided.

The component now accepts workspaceSlug and projectId as props. Ensure that these props are always provided to prevent runtime errors.

Ensure that workspaceSlug and projectId props are always provided.


Line range hint 234-257: Ensure Loader component handles loading state properly.

The Loader component is used as a fallback when completionChartDistributionData is not available. Ensure that the Loader component handles the loading state properly and provides a smooth user experience.

Ensure that the Loader component handles the loading state properly.

Tools
Biome

[error] 45-45: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 45-45: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)

web/core/components/cycles/analytics-sidebar/issue-progress.tsx (1)

Line range hint 234-257: Ensure Loader component handles loading state properly.

The Loader component is used as a fallback when completionChartDistributionData is not available. Ensure that the Loader component handles the loading state properly and provides a smooth user experience.

Ensure that the Loader component handles the loading state properly.

}
: {};

return cycle ? (
return cycle && cycle.hasOwnProperty("started_issues") ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

Use optional chaining and Object.hasOwn for property check.

Replace hasOwnProperty with Object.hasOwn and use optional chaining for safer property access.

- return cycle && cycle.hasOwnProperty("started_issues") ? (
+ return cycle?.hasOwnProperty("started_issues") ? (
- return cycle && cycle.hasOwnProperty("started_issues") ? (
+ return cycle && Object.hasOwn(cycle, "started_issues") ? (
Tools
Biome

[error] 45-45: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 45-45: Do not access Object.prototype method 'hasOwnProperty' from target object.

It's recommended using Object.hasOwn() instead of using Object.hasOwnProperty().
See MDN web docs for more details.

(lint/suspicious/noPrototypeBuiltins)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be in hooks?

@SatishGandham SatishGandham merged commit 716300d into preview Aug 27, 2024
13 of 14 checks passed
@SatishGandham SatishGandham deleted the chore/project-cycle-optimization branch August 27, 2024 14:20
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