chore: merge constants and services#8623
Conversation
📝 WalkthroughWalkthroughUpdated many import paths from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
42f32dc to
0de382b
Compare
There was a problem hiding this comment.
Pull request overview
This PR consolidates imports so the web app uses core (@/) constants and services directly instead of CE re-export (“plane-web”) indirection, and adds/moves a few shared constants/services into apps/web/core.
Changes:
- Repointed many
@/plane-web/servicesimports to direct core service modules (e.g.@/services/workspace.service,@/services/view.service). - Introduced new core modules for AI/constants, sidebar favorites constants, and an
EstimateService. - Removed CE re-export shim files (services/constants) that are no longer needed.
Reviewed changes
Copilot reviewed 42 out of 45 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/web/core/store/user/base-permissions.store.ts | Switch WorkspaceService import to core services path. |
| apps/web/core/store/state.store.ts | Switch ProjectStateService import to core services path. |
| apps/web/core/store/project-view.store.ts | Switch ViewService import to core services path. |
| apps/web/core/store/member/workspace/workspace-member.store.ts | Switch WorkspaceService import to core services path. |
| apps/web/core/store/issue/workspace/issue.store.ts | Switch WorkspaceService import to core services path. |
| apps/web/core/store/issue/workspace/filter.store.ts | Switch WorkspaceService import to core services path. |
| apps/web/core/store/issue/project-views/filter.store.ts | Switch ViewService import to core services path. |
| apps/web/core/store/issue/issue-details/relation.store.ts | Switch REVERSE_RELATIONS import to core constants. |
| apps/web/core/store/global-view.store.ts | Switch WorkspaceService import to core services path. |
| apps/web/core/store/estimates/project-estimate.store.ts | Switch estimateService import to new core estimate service. |
| apps/web/core/store/estimates/estimate-point.ts | Switch estimateService import to new core estimate service. |
| apps/web/core/services/estimate.service.ts | New core EstimateService implementation. |
| apps/web/core/services/ai.service.ts | Switch AI_EDITOR_TASKS type import to core constants. |
| apps/web/core/constants/sidebar-favorites.ts | New core sidebar favorites constants (icons + link builders). |
| apps/web/core/constants/gantt-chart.ts | Update TIssueRelationTypes import to CE types source. |
| apps/web/core/constants/ai.ts | New core AI constants (AI_EDITOR_TASKS + LOADING_TEXTS). |
| apps/web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx | Switch sidebar favorites constants import to core constants. |
| apps/web/core/components/workspace/create-workspace-form.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/project/settings/features-list.tsx | Inline project features list (replacing CE constants) and adjust rendering. |
| apps/web/core/components/power-k/ui/pages/work-item-selection-page.tsx | Remove default React import; switch WorkspaceService import to core services path. |
| apps/web/core/components/power-k/ui/modal/search-menu.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/onboarding/steps/workspace/join-invites.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/onboarding/steps/workspace/create.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/onboarding/steps/team/root.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/onboarding/invite-members.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/onboarding/invitations.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/onboarding/create-workspace.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/issues/issue-modal/components/description-editor.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/inbox/modals/create-modal/issue-description.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/home/widgets/recents/index.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/editor/rich-text/description-input/root.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/editor/lite-text/editor.tsx | Switch WorkspaceService import to core services path. |
| apps/web/core/components/account/auth-forms/auth-header.tsx | Switch WorkspaceService import to core services path. |
| apps/web/ce/store/estimates/estimate.ts | Switch estimateService import to new core estimate service. |
| apps/web/ce/services/project/project-state.service.ts | Remove CE re-export shim. |
| apps/web/ce/services/project/index.ts | Remove CE services barrel re-exports. |
| apps/web/ce/services/index.ts | Remove CE services barrel re-exports. |
| apps/web/ce/constants/project/settings/index.ts | Remove CE constants barrel re-export. |
| apps/web/ce/constants/project/settings/features.tsx | Remove CE project features constants/types source. |
| apps/web/ce/constants/project/index.ts | Remove CE constants barrel re-export. |
| apps/web/ce/components/pages/editor/ai/menu.tsx | Switch AI constants import to core constants. |
| apps/web/app/(all)/workspace-invitations/page.tsx | Switch WorkspaceService import to core services path. |
| apps/web/app/(all)/onboarding/page.tsx | Switch WorkspaceService import to core services path. |
| apps/web/app/(all)/invitations/page.tsx | Switch WorkspaceService import to core services path. |
| apps/web/app/(all)/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/[pageId]/page.tsx | Switch WorkspaceService import to core services path. |
Comments suppressed due to low confidence (1)
apps/web/core/constants/gantt-chart.ts:7
- This relative import (
../../ce/types) is brittle and bypasses the configured path aliases (@/plane-web/*). Prefer importing CE types via the alias (e.g.,@/plane-web/types) for consistency and easier refactors.
| <ProjectFeatureToggle | ||
| workspaceSlug={workspaceSlug} | ||
| projectId={projectId} | ||
| featureItem={featureItem} | ||
| value={Boolean(currentProjectDetails?.[featureItem.property as keyof IProject])} |
There was a problem hiding this comment.
ProjectFeatureToggle is typed via TProperties (in ./helper.tsx) imported from @/plane-web/constants/project/settings/features, but that module is deleted in this PR. This will cause a TS compile failure; move TProperties to a surviving location (e.g., a core types/constants module) and update ProjectFeatureToggle to import it from there (or define the prop type locally).
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@apps/web/core/components/project/settings/helper.tsx`:
- Line 41: The onChange currently passes featureItem?.key and
featureItem?.property which can be undefined; update the call site to guard
against a nullish featureItem (e.g., only call handleSubmit when featureItem is
truthy) and pass the non-nullable strings, or alternatively update
handleSubmit's signature to accept (key?: string, property?: string) and handle
undefined inside it; locate the usage of featureItem and the handleSubmit
function in this file and pick one approach so handleSubmit never receives
unexpected undefined values at runtime.
- Line 17: The field featureItem is typed as any which disables checking;
replace that with a precise type (either import the correct TProperties or
define a minimal interface describing the expected shape) and, if it can be
absent, use a union like TProperties | undefined (or the concrete interface |
undefined). Update the declaration where featureItem: any appears and ensure any
usages of featureItem are adjusted for the possibly undefined state (add
null/undefined guards or optional chaining) to satisfy strict TypeScript rules.
| workspaceSlug: string; | ||
| projectId: string; | ||
| featureItem: TProperties; | ||
| featureItem: any; |
There was a problem hiding this comment.
Avoid any — use a proper type or explicit union with undefined.
Replacing TProperties with any disables all type checking on featureItem, which masks the real issue and contradicts the project's "fully typed" guideline. If the shape of featureItem genuinely varies across editions, define a minimal interface (or import the correct type) and use Type | undefined if it can be absent.
Suggested direction
- featureItem: any;
+ featureItem: TProperties | undefined;(Adjust TProperties to whatever the correct imported type is after the constants merge.)
As per coding guidelines, **/*.{ts,tsx}: "Enable TypeScript strict mode and ensure all files are fully typed."
📝 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.
| featureItem: any; | |
| featureItem: TProperties | undefined; |
🤖 Prompt for AI Agents
In `@apps/web/core/components/project/settings/helper.tsx` at line 17, The field
featureItem is typed as any which disables checking; replace that with a precise
type (either import the correct TProperties or define a minimal interface
describing the expected shape) and, if it can be absent, use a union like
TProperties | undefined (or the concrete interface | undefined). Update the
declaration where featureItem: any appears and ensure any usages of featureItem
are adjusted for the possibly undefined state (add null/undefined guards or
optional chaining) to satisfy strict TypeScript rules.
| <ToggleSwitch | ||
| value={value} | ||
| onChange={() => handleSubmit(featureItem.key, featureItem.property)} | ||
| onChange={() => handleSubmit(featureItem?.key, featureItem?.property)} |
There was a problem hiding this comment.
handleSubmit receives undefined when featureItem is nullish.
featureItem?.key and featureItem?.property evaluate to undefined when featureItem is absent, yet handleSubmit expects (string, string). This silently passes bad data (hidden by the any type) and will likely cause bugs downstream.
Guard before calling, or make the handleSubmit signature accept undefined:
Option: guard the call
- onChange={() => handleSubmit(featureItem?.key, featureItem?.property)}
+ onChange={() => {
+ if (featureItem?.key && featureItem?.property) {
+ handleSubmit(featureItem.key, featureItem.property);
+ }
+ }}📝 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.
| onChange={() => handleSubmit(featureItem?.key, featureItem?.property)} | |
| onChange={() => { | |
| if (featureItem?.key && featureItem?.property) { | |
| handleSubmit(featureItem.key, featureItem.property); | |
| } | |
| }} |
🤖 Prompt for AI Agents
In `@apps/web/core/components/project/settings/helper.tsx` at line 41, The
onChange currently passes featureItem?.key and featureItem?.property which can
be undefined; update the call site to guard against a nullish featureItem (e.g.,
only call handleSubmit when featureItem is truthy) and pass the non-nullable
strings, or alternatively update handleSubmit's signature to accept (key?:
string, property?: string) and handle undefined inside it; locate the usage of
featureItem and the handleSubmit function in this file and pick one approach so
handleSubmit never receives unexpected undefined values at runtime.
Type of Change
Summary by CodeRabbit