Skip to content

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Nov 21, 2025

Description

This PR refactors space app mentions implementation for scalability.

Type of Change

  • Code refactoring

Note

Unifies editor mentions typing/entrypoints and refactors IssueBlockState to accept either state details or ID with minor UI cleanup.

  • Editor/Mentions:
    • Introduce TEditorMentionComponentProps type alias and use it across mentions components.
    • Update EditorMentionsRoot to import EditorAdditionalMentionsRoot and types from plane-web mentions module.
    • Remove re-exports from ce/components/editor/{embeds,index} to tighten module surface.
  • Issues/State:
    • IssueBlockState now accepts either stateId or inline stateDetails { name, group }; resolves state conditionally.
    • Mark as client component; simplify tooltip/content and icon usage (no color, no fallbacks).

Written by Cursor Bugbot for commit 76fa1ec. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

Release Notes

  • Refactor

    • Reorganized internal embeds and mentions module exports for better API encapsulation.
    • Introduced type alias for mentions component props for improved type consistency.
  • API Changes

    • Updated state property component to accept either state details (name and group) or state ID, providing greater flexibility in state management.

✏️ Tip: You can customize this high-level summary in your review settings.

@makeplane
Copy link

makeplane bot commented Nov 21, 2025

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 21, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

The PR removes public re-exports from the embeds module hierarchy, introduces a type alias for mention component props, updates imports accordingly, and refactors the state property component to accept either state details or state ID with runtime resolution.

Changes

Cohort / File(s) Change Summary
Embeds Module Re-export Cleanup
apps/space/ce/components/editor/embeds/index.ts, apps/space/ce/components/editor/index.ts
Removed public wildcard re-exports (export * from "./mentions" and export * from "./embeds") to encapsulate internal module structure
Mention Component Type Alias
apps/space/ce/components/editor/embeds/mentions/root.tsx
Added exported type alias TEditorMentionComponentProps and updated EditorAdditionalMentionsRoot function signature to use it
Mention Component Import Updates
apps/space/core/components/editor/embeds/mentions/root.tsx
Updated imports to source TEditorMentionComponentProps and adjusted corresponding function signature in EditorMentionsRoot
State Property Component Refactor
apps/space/core/components/issues/issue-layouts/properties/state.tsx
Converted to React.FC wrapped in observer; refactored Props shape to union type supporting either stateDetails or stateId; implemented runtime state resolution via getStateById() when stateId provided

Sequence Diagram(s)

sequenceDiagram
    participant Consumer as Consumer Component
    participant StateComponent as IssueBlockState
    participant Store as State Store
    
    Consumer->>StateComponent: Pass props (stateId or stateDetails)
    alt Has stateId
        StateComponent->>Store: getStateById(stateId)
        Store-->>StateComponent: Return resolved state
    else Has stateDetails
        StateComponent->>StateComponent: Use provided stateDetails
    end
    StateComponent->>StateComponent: Guard check (render nothing if falsy)
    StateComponent-->>Consumer: Render with state.name and state.group
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • State component refactor: Verify runtime state resolution logic handles both input paths correctly (stateDetails vs. stateId lookup)
  • Guard condition: Confirm the falsy state check prevents rendering issues
  • Re-export removals: Validate that no external consumers depend on the removed wildcard exports, or that they've been updated elsewhere
  • Type alias propagation: Ensure TEditorMentionComponentProps is used consistently across all affected components

Poem

🐰 Exports trimmed with careful paws,
Type aliases rewritten just because,
State now knows both paths it may take,
Runtime resolution for goodness sake!
📦✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change as a refactor of space app mentions, directly relating to the primary objectives of the PR.
Description check ✅ Passed The pull request description includes required sections (Description, Type of Change, and an informative summary), and adequately explains the refactoring scope covering mentions implementation and IssueBlockState changes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/space-mentions

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 20

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

<div className="flex w-full items-center gap-1.5">
<StateGroupIcon stateGroup={state?.group ?? "backlog"} color={state?.color} />
<div className="text-xs">{state?.name ?? "State"}</div>
<StateGroupIcon stateGroup={state.group} />
Copy link

Choose a reason for hiding this comment

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

Bug: StateGroupIcon missing color prop in refactored component

The StateGroupIcon component is called without the color prop. When state is retrieved via getStateById(), it contains a color property from the IState object that should be passed to the component. The original code passed color={state?.color}, but the refactored code removed this, causing custom state colors to be ignored in favor of default group colors.

Fix in Cursor Fix in Web

Copilot finished reviewing on behalf of aaryan610 November 21, 2025 09:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the space app mentions implementation to improve scalability by consolidating type definitions and clarifying import paths. The refactoring introduces a wrapper type TEditorMentionComponentProps in the CE layer and updates imports to use more explicit paths, while also enhancing the IssueBlockState component to support both state ID lookups and direct state details.

Key Changes:

  • Updated IssueBlockState to accept either stateId or stateDetails via discriminated union type
  • Consolidated mention component types by creating TEditorMentionComponentProps as an alias for TCallbackMentionComponentProps
  • Updated import paths to be more explicit (@/plane-web/components/editor/embeds/mentions instead of shorter paths)

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
apps/space/core/components/issues/issue-layouts/properties/state.tsx Refactored to support both stateId and stateDetails props, improved null safety, simplified StateGroupIcon usage
apps/space/core/components/editor/embeds/mentions/root.tsx Updated imports to use explicit paths and new type alias TEditorMentionComponentProps
apps/space/ce/components/editor/index.ts Deleted file - creates breaking change for ee/components/editor re-exports
apps/space/ce/components/editor/embeds/mentions/root.tsx Added type export TEditorMentionComponentProps as wrapper for TCallbackMentionComponentProps
apps/space/ce/components/editor/embeds/index.ts Deleted file - part of import path restructuring
Comments suppressed due to low confidence (1)

apps/space/ce/components/editor/index.ts:1

  • Deleting this file breaks the re-export in apps/space/ee/components/editor/index.ts, which has export * from "ce/components/editor";. This will cause a module resolution error. Consider either:
  1. Keeping this file and updating it to re-export from the correct path, or
  2. Updating apps/space/ee/components/editor/index.ts to export from the correct path directly

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

🧹 Nitpick comments (1)
apps/space/core/components/issues/issue-layouts/properties/state.tsx (1)

13-45: Props union + runtime resolution look good; clarify StoreProvider expectations

The new Props union (stateDetails vs stateId) plus the derived state and guard:

const state = "stateId" in props ? getStateById(props.stateId) : props.stateDetails;
if (!state) return null;

give you a clean, type‑safe way to either resolve from the store or pass in pre‑resolved details, and the early return nicely removes the need for optional chaining/fallbacks in the JSX. The tooltip/icon usage of state.name / state.group is straightforward.

One thing to be aware of: useStates() is still called unconditionally at the top of the component, so IssueBlockState still requires being rendered under StoreProvider even when only stateDetails are passed. If the intent was purely ergonomics (callers can avoid getStateById themselves) that’s fine; if the goal was to enable a store‑independent “pure props” usage (e.g., in places without the store context), this will still throw via useStates and might warrant either a separate pure component or hoisting the store access up to callers.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a26ce3 and 6895c5e.

📒 Files selected for processing (5)
  • apps/space/ce/components/editor/embeds/index.ts (0 hunks)
  • apps/space/ce/components/editor/embeds/mentions/root.tsx (1 hunks)
  • apps/space/ce/components/editor/index.ts (0 hunks)
  • apps/space/core/components/editor/embeds/mentions/root.tsx (1 hunks)
  • apps/space/core/components/issues/issue-layouts/properties/state.tsx (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/space/ce/components/editor/embeds/index.ts
  • apps/space/ce/components/editor/index.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: lifeiscontent
Repo: makeplane/plane PR: 7888
File: packages/propel/src/avatar/avatar.stories.tsx:2-3
Timestamp: 2025-10-01T15:30:17.605Z
Learning: In the makeplane/plane repository, avoid suggesting inline type imports (e.g., `import { Avatar, type TAvatarSize }`) due to bundler compatibility issues. Keep type imports and value imports as separate statements.
📚 Learning: 2025-10-09T20:42:31.843Z
Learnt from: lifeiscontent
Repo: makeplane/plane PR: 7922
File: apps/admin/app/(all)/(dashboard)/ai/form.tsx:19-19
Timestamp: 2025-10-09T20:42:31.843Z
Learning: In the makeplane/plane repository, React types are globally available through TypeScript configuration. Type annotations like React.FC, React.ReactNode, etc. can be used without explicitly importing the React namespace. The codebase uses the modern JSX transform, so React imports are not required for JSX or type references.

Applied to files:

  • apps/space/ce/components/editor/embeds/mentions/root.tsx
  • apps/space/core/components/editor/embeds/mentions/root.tsx
🧬 Code graph analysis (3)
apps/space/ce/components/editor/embeds/mentions/root.tsx (2)
apps/web/ce/components/editor/embeds/mentions/root.tsx (2)
  • TEditorMentionComponentProps (4-4)
  • EditorAdditionalMentionsRoot (6-8)
packages/editor/src/core/types/mention.ts (1)
  • TCallbackMentionComponentProps (19-19)
apps/space/core/components/editor/embeds/mentions/root.tsx (3)
apps/web/core/components/editor/embeds/mentions/root.tsx (1)
  • EditorMentionsRoot (7-16)
apps/space/ce/components/editor/embeds/mentions/root.tsx (1)
  • TEditorMentionComponentProps (4-4)
apps/web/ce/components/editor/embeds/mentions/root.tsx (1)
  • TEditorMentionComponentProps (4-4)
apps/space/core/components/issues/issue-layouts/properties/state.tsx (1)
apps/space/core/hooks/store/use-state.ts (1)
  • useStates (7-11)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build and lint web apps
  • GitHub Check: CodeQL analysis (javascript-typescript)
  • GitHub Check: Agent
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/space/core/components/editor/embeds/mentions/root.tsx (1)

1-15: Mentions root now aligned with plane‑web mention types — LGTM

Using TEditorMentionComponentProps from the shared plane-web embeds module and wiring EditorAdditionalMentionsRoot through that same entrypoint keeps the mentions surface consistent across apps while preserving the existing switch logic. Also good call keeping the type‑only import separate from the value import to respect bundler expectations. Based on learnings

apps/space/ce/components/editor/embeds/mentions/root.tsx (1)

4-7: Type alias + signature change are consistent with web CE — LGTM

Aliasing TEditorMentionComponentProps to TCallbackMentionComponentProps and updating EditorAdditionalMentionsRoot to use the alias keeps the type surface coherent with web while preserving behavior (still a no‑op placeholder). This should make cross‑app imports simpler without affecting runtime.

@sriramveeraghanta sriramveeraghanta merged commit 09f4e3d into preview Nov 24, 2025
6 of 7 checks passed
@sriramveeraghanta sriramveeraghanta deleted the refactor/space-mentions branch November 24, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants