Skip to content

[WEB-4531]chore: refactor for timeline chart#7440

Merged
pushya22 merged 5 commits intopreviewfrom
chore-timeline_chart_refactor
Jul 21, 2025
Merged

[WEB-4531]chore: refactor for timeline chart#7440
pushya22 merged 5 commits intopreviewfrom
chore-timeline_chart_refactor

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Jul 18, 2025

Description

This update refactors the Time line chart to a more reusable component.

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

    • Introduced support for a new grouped timeline view in Gantt charts.
    • Added a new block type categorization for Gantt chart items.
  • Enhancements

    • Gantt chart blocks now include a flexible metadata field, enabling richer information storage.
    • Timeline store extended to manage grouped timeline data.
    • Improved handling and rendering of block metadata across Gantt chart components.
  • Chores

    • Updated and streamlined component exports and import paths for better maintainability.
    • Removed redundant export modules to simplify component access.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 18, 2025

Walkthrough

This update introduces a new enum for Gantt block types and restructures the Gantt block data model to use a flexible meta property instead of a top-level project_id. The changes propagate through type definitions, store logic, helper functions, and component imports/exports, and add support for a new grouped timeline view.

Changes

Files/Groups Change Summary
packages/types/src/layout/gantt.ts Added EGanttBlockType enum; updated IGanttBlock to use meta instead of project_id; updated IBlockUpdateData and IBlockUpdateDependencyData.
apps/web/ce/store/timeline/base-timeline.store.ts, packages/utils/src/work-item/base.ts Updated block creation/updating logic to use meta object for metadata, including project_id, type, and index.
apps/web/ce/store/timeline/index.ts Added groupedTimeLineStore property to timeline store and interface; updated constructor.
apps/web/core/components/gantt-chart/contexts/index.tsx Added GROUPED member to ETimeLineTypeType enum.
apps/web/core/hooks/use-timeline-chart.ts Added support for GROUPED timeline type in hook logic.
apps/web/core/components/gantt-chart/helpers/add-block.tsx, apps/web/core/components/gantt-chart/helpers/draggable.tsx Passed meta property in block update and rendering logic.
apps/web/core/components/gantt-chart/chart/main-content.tsx Updated imports for Gantt chart block components to use absolute paths.
apps/web/core/components/gantt-chart/sidebar/root.tsx Cleaned up imports; removed overflow-hidden class from sidebar row.
apps/web/ce/components/gantt-chart/blocks/block-row-list.tsx, apps/web/ce/components/gantt-chart/blocks/blocks-list.tsx, apps/web/ee/components/gantt-chart/blocks/block-row-list.tsx, apps/web/ee/components/gantt-chart/blocks/blocks-list.tsx Added re-export statements for Gantt chart block list components.
apps/web/core/components/gantt-chart/blocks/index.ts, apps/web/core/components/gantt-chart/index.ts Removed re-export of blocks from core components to simplify exports.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant TimelineContext
    participant TimeLineStore
    participant BaseTimeLineStore

    UI->>TimelineContext: Select timeline type (e.g., GROUPED)
    TimelineContext->>TimeLineStore: Access groupedTimeLineStore
    TimeLineStore->>BaseTimeLineStore: Initialize with rootStore
    UI->>BaseTimeLineStore: updateBlocks(getDataById, type, index)
    BaseTimeLineStore->>BaseTimeLineStore: Construct IGanttBlock with meta {type, index, project_id}
    BaseTimeLineStore-->>UI: Updated block list
Loading

Estimated code review effort

3 (30–60 minutes)

Suggested labels

🧹chore, ready to merge

Suggested reviewers

  • prateekshourya29
  • sriramveeraghanta

Poem

A hop, a skip, a meta-bound leap,
Gantt blocks now secrets in their metadata keep.
Types and stores—tidy and new,
Grouped timelines join the view.
With enums and exports all in line,
This bunny says: the chart will shine!
🐇✨


📜 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 89f8157 and 53d5138.

📒 Files selected for processing (6)
  • apps/web/ce/components/gantt-chart/blocks/block-row-list.tsx (1 hunks)
  • apps/web/ce/components/gantt-chart/blocks/blocks-list.tsx (1 hunks)
  • apps/web/core/components/gantt-chart/blocks/index.ts (0 hunks)
  • apps/web/core/components/gantt-chart/index.ts (0 hunks)
  • apps/web/ee/components/gantt-chart/blocks/block-row-list.tsx (1 hunks)
  • apps/web/ee/components/gantt-chart/blocks/blocks-list.tsx (1 hunks)
💤 Files with no reviewable changes (2)
  • apps/web/core/components/gantt-chart/index.ts
  • apps/web/core/components/gantt-chart/blocks/index.ts
✅ Files skipped from review due to trivial changes (2)
  • apps/web/ce/components/gantt-chart/blocks/block-row-list.tsx
  • apps/web/ce/components/gantt-chart/blocks/blocks-list.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/web/ee/components/gantt-chart/blocks/blocks-list.tsx
  • apps/web/ee/components/gantt-chart/blocks/block-row-list.tsx
⏰ 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). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
✨ 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.

@vamsikrishnamathala vamsikrishnamathala changed the title chore: refactor for timeline chart [WEB-4531]chore: refactor for timeline chart Jul 21, 2025
@makeplane
Copy link

makeplane bot commented Jul 21, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review July 21, 2025 07:57
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: 3

♻️ Duplicate comments (1)
apps/web/ce/store/timeline/base-timeline.store.ts (1)

69-70: blocksMap could use Map
Previous reviews flagged that Map<string, IGanttBlock> provides faster look-ups and avoids accidental key collisions compared with a plain object. The refactor didn’t address this.

🧹 Nitpick comments (3)
apps/web/core/components/gantt-chart/helpers/draggable.tsx (1)

56-56: Confirm meta collision & tighten typings

Spreading block.data first means any existing meta field inside data gets silently replaced.
If meta is already allowed on the server payload this could mask bugs. Consider either:

- { ...block.data, meta: block.meta }
+ { ...block.data, ...(block.data.meta ? { _originalMeta: block.data.meta } : {}), meta: block.meta }

or assert that block.data never contains meta.

Also, update the blockToRender callback to use a typed interface instead of any, so TS can warn on such collisions.

apps/web/core/components/gantt-chart/chart/main-content.tsx (1)

15-16: Consider harmonising import bases
With GanttChartRowList / GanttChartBlocksList now coming from @/plane-web/... while the rest of the chart pieces still arrive from @/components/gantt-chart, we end up with mixed roots for the same feature set. If the barrel already re-exports these two components, importing all chart parts from one place keeps paths uniform and future moves easier.

apps/web/ce/store/timeline/index.ts (1)

10-11: Remember lifecycle management for the new store
groupedTimeLineStore is instantiated but never torn down.
If this store sets up reactions/autoruns, add a destroy()/dispose() hook on the parent store (or wherever appropriate) to avoid memory leaks when the root store is recycled (e.g. on logout).

Also applies to: 17-18, 24-25

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between df4ea1f and 95896e1.

📒 Files selected for processing (14)
  • apps/web/ce/components/gantt-chart/blocks/block-row-list.tsx (1 hunks)
  • apps/web/ce/components/gantt-chart/blocks/blocks-list.tsx (1 hunks)
  • apps/web/ce/store/timeline/base-timeline.store.ts (3 hunks)
  • apps/web/ce/store/timeline/index.ts (1 hunks)
  • apps/web/core/components/gantt-chart/chart/main-content.tsx (1 hunks)
  • apps/web/core/components/gantt-chart/contexts/index.tsx (1 hunks)
  • apps/web/core/components/gantt-chart/helpers/add-block.tsx (1 hunks)
  • apps/web/core/components/gantt-chart/helpers/draggable.tsx (1 hunks)
  • apps/web/core/components/gantt-chart/sidebar/root.tsx (2 hunks)
  • apps/web/core/hooks/use-timeline-chart.ts (1 hunks)
  • apps/web/ee/components/gantt-chart/blocks/block-row-list.tsx (1 hunks)
  • apps/web/ee/components/gantt-chart/blocks/blocks-list.tsx (1 hunks)
  • packages/types/src/layout/gantt.ts (3 hunks)
  • packages/utils/src/work-item/base.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
apps/web/core/components/gantt-chart/sidebar/root.tsx (1)

Learnt from: janreges
PR: #6743
File: packages/i18n/src/store/index.ts:160-161
Timestamp: 2025-03-11T19:42:41.769Z
Learning: In the Plane project, the file 'packages/i18n/src/store/index.ts' already includes support for Polish language translations with the case "pl".

apps/web/core/components/gantt-chart/chart/main-content.tsx (2)

Learnt from: mathalav55
PR: #6107
File: web/ce/components/workspace-notifications/sidebar/notification-card/options/read.tsx:11-12
Timestamp: 2024-11-28T07:02:15.514Z
Learning: Some components are still in core and have not been moved yet, so their import paths remain the same.

Learnt from: mathalav55
PR: #6107
File: web/ce/components/workspace-notifications/sidebar/notification-card/options/archive.tsx:11-14
Timestamp: 2024-11-28T07:02:54.664Z
Learning: When components are still located in core, it's appropriate for files to import them using @/components/..., and the migration to the new import paths is not necessary in such cases.

packages/utils/src/work-item/base.ts (1)

Learnt from: vamsikrishnamathala
PR: #7214
File: web/core/store/issue/helpers/base-issues.store.ts:117-117
Timestamp: 2025-06-16T07:23:39.497Z
Learning: In the updateIssueDates method of BaseIssuesStore (web/core/store/issue/helpers/base-issues.store.ts), the projectId parameter is intentionally made optional to support override implementations in subclasses. The base implementation requires projectId and includes an early return check, but making it optional allows derived classes to override the method with different parameter requirements.

apps/web/ce/store/timeline/index.ts (1)

Learnt from: vamsikrishnamathala
PR: #7214
File: web/core/store/issue/helpers/base-issues.store.ts:117-117
Timestamp: 2025-06-16T07:23:39.497Z
Learning: In the updateIssueDates method of BaseIssuesStore (web/core/store/issue/helpers/base-issues.store.ts), the projectId parameter is intentionally made optional to support override implementations in subclasses. The base implementation requires projectId and includes an early return check, but making it optional allows derived classes to override the method with different parameter requirements.

packages/types/src/layout/gantt.ts (1)

Learnt from: vamsikrishnamathala
PR: #7214
File: web/core/store/issue/helpers/base-issues.store.ts:117-117
Timestamp: 2025-06-16T07:23:39.497Z
Learning: In the updateIssueDates method of BaseIssuesStore (web/core/store/issue/helpers/base-issues.store.ts), the projectId parameter is intentionally made optional to support override implementations in subclasses. The base implementation requires projectId and includes an early return check, but making it optional allows derived classes to override the method with different parameter requirements.

apps/web/ce/store/timeline/base-timeline.store.ts (1)

Learnt from: vamsikrishnamathala
PR: #7214
File: web/core/store/issue/helpers/base-issues.store.ts:117-117
Timestamp: 2025-06-16T07:23:39.497Z
Learning: In the updateIssueDates method of BaseIssuesStore (web/core/store/issue/helpers/base-issues.store.ts), the projectId parameter is intentionally made optional to support override implementations in subclasses. The base implementation requires projectId and includes an early return check, but making it optional allows derived classes to override the method with different parameter requirements.

🧬 Code Graph Analysis (2)
apps/web/core/hooks/use-timeline-chart.ts (1)
apps/web/ce/store/timeline/base-timeline.store.ts (1)
  • IBaseTimelineStore (34-66)
apps/web/ce/store/timeline/index.ts (1)
apps/web/ce/store/timeline/base-timeline.store.ts (2)
  • IBaseTimelineStore (34-66)
  • BaseTimeLineStore (68-341)
🔇 Additional comments (12)
apps/web/core/components/gantt-chart/sidebar/root.tsx (2)

5-5: Type-only import looks good

Switching to a type-only import avoids including the type in JS output—nice touch.


85-99: Re-evaluate removal of overflow-hidden

Dropping overflow-hidden from the content wrapper can let long block titles or drag overlays bleed outside the sidebar on small widths, producing a horizontal scrollbar. Double-check in narrow layouts (e.g. 1024 px) that nothing overflows before merging.

apps/web/core/components/gantt-chart/contexts/index.tsx (1)

7-8: Ensure exhaustive switch handling for new GROUPED type

Any reducers, switch/match helpers, or MobX reactions that assume the enum is exhaustive now need a GROUPED branch, otherwise TypeScript’s never exhaustiveness checks (or runtime fall-through) will break.

apps/web/core/components/gantt-chart/helpers/add-block.tsx (1)

49-52: Good catch forwarding meta

Passing block.meta preserves the enriched context needed by stores—looks correct.

apps/web/ce/components/gantt-chart/blocks/block-row-list.tsx (1)

1-1: Barrel export OK

Re-export keeps CE paths consistent with core; no issues.

apps/web/ee/components/gantt-chart/blocks/blocks-list.tsx (1)

1-1: Barrel export OK

Mirrors CE implementation—looks good.

apps/web/ee/components/gantt-chart/blocks/block-row-list.tsx (1)

1-1: Re-export looks good

Straightforward barrel export; keeps EE layer thin.

apps/web/core/hooks/use-timeline-chart.ts (1)

20-21: Unnecessary nullish guard for groupedTimeLineStore

The groupedTimeLineStore field is declared and immediately initialized in the TimelineStore constructor (apps/web/ce/store/timeline/index.ts:24), so it can never be undefined. No additional nullish check or error throw is needed here.

Likely an incorrect or invalid review comment.

apps/web/ce/components/gantt-chart/blocks/blocks-list.tsx (1)

1-1: Barrel export OK

Keeps import paths consistent between CE/EE layers.

apps/web/core/components/gantt-chart/chart/main-content.tsx (1)

9-9: Import list looks good after barrel split
GanttChartBlocksList was cleanly removed from the core barrel import; no other usage change required.

apps/web/ce/store/timeline/base-timeline.store.ts (1)

6-12: Import bundle OK
New enum pulled in; no issues.

packages/types/src/layout/gantt.ts (1)

1-5: Nice explicit typing for block kinds
The EGanttBlockType enum clarifies intent.

@pushya22 pushya22 merged commit 4c3af7f into preview Jul 21, 2025
5 of 6 checks passed
@pushya22 pushya22 deleted the chore-timeline_chart_refactor branch July 21, 2025 13:53
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