Skip to content

refactor: unused components, hooks, constants#7157

Merged
sriramveeraghanta merged 4 commits intopreviewfrom
refactor/unused-entities
Jun 6, 2025
Merged

refactor: unused components, hooks, constants#7157
sriramveeraghanta merged 4 commits intopreviewfrom
refactor/unused-entities

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Jun 3, 2025

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

Summary by CodeRabbit

  • Bug Fixes
    • Removed dashboard widgets and related components, including issue lists, activity, collaborators, projects, and statistics from the dashboard interface.
    • Eliminated various UI elements such as loaders, empty states, error states, dropdowns, and dynamic positioning hooks related to dashboard widgets.
    • Removed support for comment reactions, URL hash management, and Crisp chat integration.
    • Cleaned up unused constants, helper functions, and dependencies for improved stability and performance.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 3, 2025

Walkthrough

This change removes a large set of dashboard-related React components, hooks, utility functions, and index files from the codebase. It eliminates many widgets, loaders, empty/error states, helper functions, and associated cache key generators, along with related dependencies. Centralized re-export files and several utility hooks are also deleted.

Changes

File(s) Change Summary
web/core/components/dashboard/index.ts, web/core/components/dashboard/widgets/index.ts, web/core/components/dashboard/widgets/empty-states/index.ts, web/core/components/dashboard/widgets/error-states/index.ts, web/core/components/dashboard/widgets/dropdowns/index.ts, web/core/components/dashboard/widgets/loaders/index.ts, web/core/components/dashboard/widgets/issue-panels/index.ts Deleted index files that re-exported modules for centralized imports.
web/core/components/dashboard/project-empty-state.tsx Deleted DashboardProjectEmptyState component for onboarding users to create their first project.
web/core/components/dashboard/widgets/assigned-issues.tsx Deleted AssignedIssuesWidget component for displaying assigned issues.
web/core/components/dashboard/widgets/created-issues.tsx Deleted CreatedIssuesWidget component for displaying created issues.
web/core/components/dashboard/widgets/dropdowns/duration-filter.tsx Deleted DurationFilterDropdown component for selecting duration filters.
web/core/components/dashboard/widgets/empty-states/assigned-issues.tsx, web/core/components/dashboard/widgets/empty-states/created-issues.tsx, web/core/components/dashboard/widgets/empty-states/issues-by-priority.tsx, web/core/components/dashboard/widgets/empty-states/issues-by-state-group.tsx, web/core/components/dashboard/widgets/empty-states/recent-activity.tsx, web/core/components/dashboard/widgets/empty-states/recent-collaborators.tsx Deleted empty state components for various dashboard widgets.
web/core/components/dashboard/widgets/error-states/issues.tsx Deleted IssuesErrorState component for widget error display.
web/core/components/dashboard/widgets/issue-panels/issue-list-item.tsx, web/core/components/dashboard/widgets/issue-panels/issues-list.tsx, web/core/components/dashboard/widgets/issue-panels/tabs-list.tsx Deleted issue list item, list, and tabs components for dashboard widgets.
web/core/components/dashboard/widgets/loaders/assigned-issues.tsx, web/core/components/dashboard/widgets/loaders/issues-by-priority.tsx, web/core/components/dashboard/widgets/loaders/issues-by-state-group.tsx, web/core/components/dashboard/widgets/loaders/overview-stats.tsx, web/core/components/dashboard/widgets/loaders/recent-activity.tsx, web/core/components/dashboard/widgets/loaders/recent-collaborators.tsx, web/core/components/dashboard/widgets/loaders/recent-projects.tsx, web/core/components/dashboard/widgets/loaders/loader.tsx Deleted loader components for various dashboard widgets.
web/core/components/dashboard/widgets/overview-stats.tsx Deleted OverviewStatsWidget component and its type.
web/core/components/dashboard/widgets/recent-activity.tsx Deleted RecentActivityWidget component for recent user activity.
web/core/components/dashboard/widgets/recent-collaborators/collaborators-list.tsx Deleted CollaboratorsList component for listing recent collaborators.
web/core/components/dashboard/widgets/recent-collaborators/index.ts, web/core/components/dashboard/widgets/recent-collaborators/root.tsx Removed re-export and deleted RecentCollaboratorsWidget component.
web/core/components/dashboard/widgets/recent-projects.tsx Deleted RecentProjectsWidget component for listing recent projects.
web/core/constants/fetch-keys.ts Removed many exported cache key generators and constants for issues, projects, cycles, modules, pages, etc.
web/core/hooks/use-comment-reaction.tsx Deleted useCommentReaction custom hook for managing comment reactions.
web/core/hooks/use-dynamic-dropdown.tsx Deleted useDynamicDropdownPosition custom hook for dropdown positioning.
web/core/hooks/use-url-hash.tsx Deleted useURLHash hook for accessing the URL hash fragment.
web/core/lib/wrappers/crisp-wrapper.tsx Deleted CrispWrapper component for Crisp chat integration.
web/helpers/string.helper.ts Removed getFetchKeysForIssueMutation helper function and related imports.
web/package.json Removed dependencies: @blueprintjs/popover2 and use-debounce.

Sequence Diagram(s)

No sequence diagram generated as the changes are broad deletions and cleanup without new or altered control flow.

Suggested labels

🧹chore, 🛠️refactor, ready_to_merge

Poem

A dashboard once bustling with widgets and flair,
Now swept by the rabbit with diligent care.
Gone are the loaders, the states, and the keys—
The codebase feels lighter, with newfound ease!
🐇✨
Refactored and tidy, it hops on its way,
Ready for sunshine and a brand new day!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6648201 and 3729e4d.

📒 Files selected for processing (2)
  • web/core/constants/fetch-keys.ts (1 hunks)
  • web/package.json (0 hunks)
💤 Files with no reviewable changes (1)
  • web/package.json
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
web/core/constants/fetch-keys.ts (2)

54-54:

Details

✅ Verification successful

Verify the usage of WORKSPACE_INVITATION after the cleanup.

This function was modified in this PR. Given that the summary mentions removal of workspace invitation-related keys, please verify that this remaining function is still actively used in the codebase.


🏁 Script executed:

#!/bin/bash
# Description: Check usage of WORKSPACE_INVITATION function

echo "Searching for WORKSPACE_INVITATION usage..."
rg "WORKSPACE_INVITATION" --type ts --type tsx --type js --type jsx -A 2 -B 2 | grep -v "fetch-keys.ts"

Length of output: 226


I’ll correct the ripgrep invocation to include .tsx files and properly exclude the definition file, then re-run the search:


🏁 Script executed:

#!/bin/bash
# Corrected search for WORKSPACE_INVITATION usage across TS/JS files, excluding its own definition.
echo "Searching for WORKSPACE_INVITATION usage..."
rg "WORKSPACE_INVITATION" -n -g "*.ts" -g "*.tsx" -g "*.js" -g "*.jsx" \
  | grep -v "web/core/constants/fetch-keys.ts"

Length of output: 1307


WORKSPACE_INVITATION remains in use

Confirmed that WORKSPACE_INVITATION is still imported and invoked in your code:

  • web/app/(all)/workspace-invitations/page.tsx
    • Line 12: import { WORKSPACE_INVITATION } from "@/constants/fetch-keys";
    • Line 38: … && WORKSPACE_INVITATION(invitation_id.toString()),

Since this key generator is actively used, it should remain as-is.


50-118:

Details

✅ Verification successful

Verify that all remaining cache key exports are actively used.

After the extensive cleanup of dashboard-related components, ensure that all the remaining cache key exports in this file are still being utilized in the codebase. Unused exports should be removed to maintain a clean codebase.


🏁 Script executed:

#!/bin/bash
# Description: Check usage of all exported cache key functions

echo "Checking usage of cache key exports..."

# List of exports to check
exports=(
    "USER_WORKSPACES_LIST"
    "WORKSPACE_MEMBERS"
    "WORKSPACE_INVITATION" 
    "PROJECT_DETAILS"
    "PROJECT_MEMBERS"
    "PROJECT_GITHUB_REPOSITORY"
    "CYCLE_ISSUES_WITH_PARAMS"
    "USER_ACTIVITY"
    "ISSUE_DETAILS"
    "APP_INTEGRATIONS"
    "WORKSPACE_INTEGRATIONS"
    "JIRA_IMPORTER_DETAIL"
    "IMPORTER_SERVICES_LIST"
    "EXPORT_SERVICES_LIST"
    "GITHUB_REPOSITORY_INFO"
    "SLACK_CHANNEL_INFO"
    "USER_PROFILE_DATA"
    "USER_PROFILE_ACTIVITY"
    "USER_PROFILE_PROJECT_SEGREGATION"
    "API_TOKENS_LIST"
)

for export in "${exports[@]}"; do
    echo -e "\n=== Checking usage of '$export' ==="
    count=$(rg "$export" --type ts --type tsx --type js --type jsx | grep -v "fetch-keys.ts" | wc -l)
    if [ $count -eq 0 ]; then
        echo "⚠️  WARNING: '$export' appears to be unused"
    else
        echo "✓ Found $count usage(s) of '$export'"
    fi
done

Length of output: 9260


🏁 Script executed:

#!/usr/bin/env bash
# Revised usage check for cache key exports using file globs

echo "Checking usage of cache key exports..."

exports=(
  "USER_WORKSPACES_LIST"
  "WORKSPACE_MEMBERS"
  "WORKSPACE_INVITATION"
  "PROJECT_DETAILS"
  "PROJECT_MEMBERS"
  "PROJECT_GITHUB_REPOSITORY"
  "CYCLE_ISSUES_WITH_PARAMS"
  "USER_ACTIVITY"
  "ISSUE_DETAILS"
  "APP_INTEGRATIONS"
  "WORKSPACE_INTEGRATIONS"
  "JIRA_IMPORTER_DETAIL"
  "IMPORTER_SERVICES_LIST"
  "EXPORT_SERVICES_LIST"
  "GITHUB_REPOSITORY_INFO"
  "SLACK_CHANNEL_INFO"
  "USER_PROFILE_DATA"
  "USER_PROFILE_ACTIVITY"
  "USER_PROFILE_PROJECT_SEGREGATION"
  "API_TOKENS_LIST"
)

for key in "${exports[@]}"; do
  echo -e "\n=== Checking usage of '$key' ==="
  count=$(rg "$key" -g '*.ts' -g '*.tsx' -g '*.js' -g '*.jsx' \
    | grep -v 'fetch-keys.ts' \
    | wc -l)
  if [ "$count" -eq 0 ]; then
    echo "⚠️  WARNING: '$key' appears to be unused"
  else
    echo "✓ Found $count usage(s) of '$key'"
  fi
done

Length of output: 8160


All cache key exports in fetch-keys.ts are actively used

I’ve searched across the codebase for every export in web/core/constants/fetch-keys.ts and confirmed that each one has at least one usage. No unused keys were found, so you can safely keep all of them.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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>, please review it.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using 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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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.

@aaryan610 aaryan610 marked this pull request as ready for review June 6, 2025 05:45
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

🔭 Outside diff range comments (1)
web/core/constants/fetch-keys.ts (1)

3-3: 🛠️ Refactor suggestion

Replace any type with a proper interface for type safety.

Using any type defeats TypeScript's type checking benefits and could lead to runtime errors if the params structure changes.

Consider defining an interface for the params:

-const paramsToKey = (params: any) => {
+interface IFetchKeyParams {
+  state?: string;
+  state_group?: string;
+  priority?: string;
+  mentions?: string;
+  assignees?: string;
+  created_by?: string;
+  labels?: string;
+  start_date?: string;
+  target_date?: string;
+  sub_issue?: string;
+  project?: string;
+  layout?: string;
+  subscriber?: string;
+  type?: string;
+  group_by?: string;
+  order_by?: string;
+}
+
+const paramsToKey = (params: IFetchKeyParams) => {
🧹 Nitpick comments (2)
web/core/constants/fetch-keys.ts (2)

47-47: Consider breaking down the long concatenated string for better maintainability.

The current implementation creates a very long cache key that's hard to read and maintain. Consider using an array join approach or template literals with better formatting.

-  return `${layoutKey}_${projectKey}_${stateGroupKey}_${stateKey}_${priorityKey}_${assigneesKey}_${mentionsKey}_${createdByKey}_${type}_${groupBy}_${orderBy}_${labelsKey}_${startDateKey}_${targetDateKey}_${sub_issue}_${subscriberKey}`;
+  const keyParts = [
+    layoutKey,
+    projectKey,
+    stateGroupKey,
+    stateKey,
+    priorityKey,
+    assigneesKey,
+    mentionsKey,
+    createdByKey,
+    type,
+    groupBy,
+    orderBy,
+    labelsKey,
+    startDateKey,
+    targetDateKey,
+    sub_issue,
+    subscriberKey
+  ].filter(Boolean); // Remove empty values
+  
+  return keyParts.join("_");

50-126: Consider adding JSDoc comments for exported functions.

After the refactoring that removed many dashboard-related exports, it would be helpful to document the remaining exported functions to clarify their purpose and expected parameter formats.

Example for one function:

+/**
+ * Generates a cache key for workspace members
+ * @param workspaceSlug - The workspace identifier
+ * @returns Uppercase cache key string
+ */
 export const WORKSPACE_MEMBERS = (workspaceSlug: string) => `WORKSPACE_MEMBERS_${workspaceSlug.toUpperCase()}`;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 533644f and 6648201.

📒 Files selected for processing (1)
  • web/core/constants/fetch-keys.ts (1 hunks)
🔇 Additional comments (1)
web/core/constants/fetch-keys.ts (1)

54-54: LGTM!

The function follows the established pattern for cache key generation.

@sriramveeraghanta sriramveeraghanta merged commit 245167e into preview Jun 6, 2025
4 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the refactor/unused-entities branch June 6, 2025 08:39
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* refactor: remove unused dashboard components and fetch keys

* refactor: remove unused hooks and wrappers

* chore: remove unused function
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.

2 participants