Skip to content

fix: move lucide related constants to ui package#7226

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
fix-lucide-constants
Jun 17, 2025
Merged

fix: move lucide related constants to ui package#7226
sriramveeraghanta merged 2 commits intopreviewfrom
fix-lucide-constants

Conversation

@prateekshourya29
Copy link
Member

@prateekshourya29 prateekshourya29 commented Jun 17, 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

  • New Features

    • Added new "Search" and "User" icons to the available icon set.
    • Introduced a utility function to retrieve a random icon name.
  • Refactor

    • Updated import paths for icon lists to improve consistency and maintainability.
    • Consolidated and reorganized export statements for easier access to modules and utilities.
    • Removed duplicate and unnecessary exports to streamline the codebase.
  • Chores

    • Removed unused icon exports and related utility functions from certain packages.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 17, 2025

Walkthrough

The changes reorganize icon-related exports and imports, shifting icon constants and utilities from the constants package to the UI package. New icons are added, utility functions are relocated, and import paths are updated throughout the codebase to reflect the new structure. Export statements are consolidated for clarity.

Changes

File(s) Change Summary
packages/constants/src/index.ts Removed export of ./icons module.
packages/ui/src/constants/icons.ts Added Search and User icons to LUCIDE_ICONS_LIST.
packages/ui/src/constants/index.ts Added export of all from ./icons.
packages/ui/src/emoji/icons-list.tsx,
logo.tsx,
lucide-icons-list.tsx
Changed imports of icon lists from package to relative paths.
packages/ui/src/index.ts Consolidated and reordered export statements; removed duplicates; added new export paths.
packages/ui/src/utils/icons.ts Added new utility function getRandomIconName returning a random icon name from LUCIDE_ICONS_LIST.
packages/ui/src/utils/index.ts Re-exported all from ./icons.
packages/utils/src/emoji.ts Removed import and export of LUCIDE_ICONS_LIST and getRandomIconName.
web/core/components/common/logo.tsx Changed import of LUCIDE_ICONS_LIST from constants to UI package.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant UI_Constants
    participant UI_Utils
    participant LucideIcons

    App->>UI_Constants: import { LUCIDE_ICONS_LIST }
    App->>UI_Utils: import { getRandomIconName }
    UI_Utils->>UI_Constants: access LUCIDE_ICONS_LIST
    UI_Constants->>LucideIcons: import { Search, User }
    UI_Utils-->>App: return random icon name
Loading

Suggested labels

🌟improvement

Poem

In burrows deep, the icons hop,
New friends join in—no sign to stop!
Utilities leap to a brand new nest,
Exports are tidy, code at its best.
With Search and User, the list grows bright,
The UI garden’s a joyful sight!
🐰✨

✨ 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.

@prateekshourya29 prateekshourya29 marked this pull request as ready for review June 17, 2025 11:15
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: 4

🧹 Nitpick comments (5)
web/core/components/common/logo.tsx (1)

11-11: Consider importing the constant directly to optimise bundle size

@plane/ui is the barrel for the whole UI package; pulling from it forces the bundler to evaluate the complete public surface, which may hinder tree-shaking.
Importing from the dedicated constants entry (e.g. @plane/ui/constants) keeps the dependency graph lean and avoids accidental circular refs.

-import { LUCIDE_ICONS_LIST } from "@plane/ui";
+import { LUCIDE_ICONS_LIST } from "@plane/ui/constants";
packages/ui/src/constants/icons.ts (2)

150-157: Import list got out of alphabetical order

Search (S) is placed after ToggleLeft (T), and User (U) is split from UsersRound. Keeping the Lucide import block strictly alphabetical greatly reduces merge conflicts and eases future diff reviews.

-  ToggleLeft,
-  Search,
-  User,
+  Search,
+  ToggleLeft,
+  User,

917-920: Duplicate / unsorted entries in LUCIDE_ICONS_LIST

Search and User are added correctly, but the surrounding block is no longer sorted alphabetically (Search should precede ToggleLeft). Re-ordering avoids accidental duplicates and simplifies look-ups.

-  { name: "ToggleLeft", element: ToggleLeft },
-  { name: "User", element: User },
+  { name: "Search", element: Search },
+  { name: "ToggleLeft", element: ToggleLeft },
+  { name: "User", element: User },
packages/ui/src/utils/icons.ts (1)

6-7: Minor: micro-optimise random selection

No action required, but Math.trunc is marginally faster and semantically clearer than Math.floor here.

-  LUCIDE_ICONS_LIST[Math.floor(Math.random() * LUCIDE_ICONS_LIST.length)].name;
+  LUCIDE_ICONS_LIST[Math.trunc(Math.random() * LUCIDE_ICONS_LIST.length)].name;
packages/ui/src/index.ts (1)

1-38: Barrel export list growing – enforce ordering or grouping

This file now exports 30+ sub-modules. Without a consistent order (alphabetical or grouped), merge conflicts become painful.

Consider:

  1. Alphabetically sorting the export lines, or
  2. Splitting into thematic sections with comments (e.g. Primitives, Data-display, Helpers).

This is a low-effort future-proofing tweak.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 75f89c4 and 7f5ae47.

📒 Files selected for processing (11)
  • packages/constants/src/index.ts (0 hunks)
  • packages/ui/src/constants/icons.ts (2 hunks)
  • packages/ui/src/constants/index.ts (1 hunks)
  • packages/ui/src/emoji/icons-list.tsx (1 hunks)
  • packages/ui/src/emoji/logo.tsx (1 hunks)
  • packages/ui/src/emoji/lucide-icons-list.tsx (1 hunks)
  • packages/ui/src/index.ts (1 hunks)
  • packages/ui/src/utils/icons.ts (1 hunks)
  • packages/ui/src/utils/index.ts (1 hunks)
  • packages/utils/src/emoji.ts (1 hunks)
  • web/core/components/common/logo.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • packages/constants/src/index.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
packages/ui/src/utils/icons.ts (1)
packages/ui/src/constants/icons.ts (1)
  • LUCIDE_ICONS_LIST (765-921)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (3)
packages/ui/src/utils/index.ts (1)

1-1: 👍 Good addition – utilities now surfaced from a single entry point

Re-exporting ./icons through utils improves DX; no issues spotted.

packages/ui/src/constants/index.ts (1)

1-1: Re-export looks fine, but validate bundle impact

Re-exporting the full icons list from the UI package means every consumer of @plane/ui can now pull ~900 Lucide imports by accident. Please double-check that:

  1. Consumers only import what they actually need (tree-shaking works).
  2. There are no name clashes with other constants exported from this barrel.

If either is a concern, consider exposing the icons list under a dedicated sub-path (e.g. @plane/ui/icons) instead of the generic @plane/ui.

packages/utils/src/emoji.ts (1)

4-4: LGTM – removed unused import

Dropping LUCIDE_ICONS_LIST keeps this util focused on emoji. No further action.

// icons
import useFontFaceObserver from "use-font-face-observer";
import { MATERIAL_ICONS_LIST } from "@plane/constants";
import { MATERIAL_ICONS_LIST } from "..";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Wrong barrel used – high chance of circular dependency or missing export

"..” resolves to the root ​src/index.ts, which in many libraries re-exports this component, leading to a circular import at runtime (or, worse, MATERIAL_ICONS_LIST being undefined if the constant is initialised later).

Import the constant from the dedicated constants barrel instead:

-import { MATERIAL_ICONS_LIST } from "..";
+import { MATERIAL_ICONS_LIST } from "../constants";
🤖 Prompt for AI Agents
In packages/ui/src/emoji/icons-list.tsx at line 5, the import of
MATERIAL_ICONS_LIST from ".." causes a circular dependency or may result in
MATERIAL_ICONS_LIST being undefined. To fix this, change the import to reference
the dedicated constants barrel file where MATERIAL_ICONS_LIST is explicitly
exported, avoiding indirect imports through the root index.ts.

// plane imports
import { LUCIDE_ICONS_LIST } from "@plane/constants";
// local imports
import { LUCIDE_ICONS_LIST } from "..";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Same barrel-circularity problem as above

Use the constants sub-module to avoid circular references and clarify intent.

-import { LUCIDE_ICONS_LIST } from "..";
+import { LUCIDE_ICONS_LIST } from "../constants";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { LUCIDE_ICONS_LIST } from "..";
import { LUCIDE_ICONS_LIST } from "../constants";
🤖 Prompt for AI Agents
In packages/ui/src/emoji/logo.tsx at line 5, the import of LUCIDE_ICONS_LIST
from the parent directory causes a circular dependency. To fix this, change the
import to come from the constants sub-module instead, which will avoid circular
references and make the import purpose clearer.

// plane imports
import { LUCIDE_ICONS_LIST } from "@plane/constants";
// local imports
import { LUCIDE_ICONS_LIST } from "..";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Import path should point at the constants barrel

For consistency and to prevent cyclical imports, fetch the list from the constants module, not the package root.

-import { LUCIDE_ICONS_LIST } from "..";
+import { LUCIDE_ICONS_LIST } from "../constants";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { LUCIDE_ICONS_LIST } from "..";
import { LUCIDE_ICONS_LIST } from "../constants";
🤖 Prompt for AI Agents
In packages/ui/src/emoji/lucide-icons-list.tsx at line 4, the import path for
LUCIDE_ICONS_LIST should be updated to import from the constants barrel module
instead of the package root. Change the import statement to point directly to
the constants module to maintain consistency and avoid cyclical imports.

@@ -0,0 +1,7 @@
import { LUCIDE_ICONS_LIST } from "..";
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Circular import & wrong source – import the list directly

icons.ts lives under utils/ but pulls LUCIDE_ICONS_LIST from the UI package barrel ("..").
At runtime this introduces an avoidable circular-dependency chain:

ui/indexutils/indexutils/iconsback to ui/index

and couples a tiny util to the heavy top-level barrel.

Import the source constant directly to break the cycle and shave bundle size:

-import { LUCIDE_ICONS_LIST } from "..";
+import { LUCIDE_ICONS_LIST } from "../constants";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { LUCIDE_ICONS_LIST } from "..";
-import { LUCIDE_ICONS_LIST } from "..";
+import { LUCIDE_ICONS_LIST } from "../constants";
🤖 Prompt for AI Agents
In packages/ui/src/utils/icons.ts at line 1, the import of LUCIDE_ICONS_LIST
from the UI package barrel ("..") causes a circular dependency and increases
bundle size. To fix this, change the import to reference the original source
file where LUCIDE_ICONS_LIST is defined directly, avoiding the top-level barrel
import and breaking the circular dependency chain.

@sriramveeraghanta sriramveeraghanta merged commit 53e6a62 into preview Jun 17, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-lucide-constants branch June 17, 2025 11:36
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* fix: move lucide related constants to ui package

* chore: update yarn.lock
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