Skip to content

Conversation

@rahulramesha
Copy link
Contributor

@rahulramesha rahulramesha commented Dec 4, 2024

This PR removes the shouldIgnoreDependencies flag while dragging in timeline view

Summary by CodeRabbit

  • New Features

    • Improved block resizing functionality in the Gantt chart for a more intuitive user experience.
  • Bug Fixes

    • Enhanced error handling during block resizing to provide clearer notifications with specific feedback.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2024

Walkthrough

The changes made in this pull request focus on the useGanttResizable hook within the use-gantt-resizable.ts file. The modifications primarily streamline the parameters in the handleMouseMove and handleMouseUp functions by removing the dragDirection !== "move" argument from calls to updateBlockPosition and getUpdatedPositionAfterDrag. Additionally, the error handling in handleMouseUp has been adjusted to reference the setToast function correctly, enhancing the error notification mechanism.

Changes

File Path Change Summary
web/core/components/gantt-chart/helpers/... - Updated handleMouseMove: removed dragDirection !== "move" from updateBlockPosition.
- Updated handleMouseUp: removed dragDirection !== "move" from getUpdatedPositionAfterDrag.
- Modified error handling in handleMouseUp to correctly invoke setToast with error details.

Possibly related PRs

  • [WEB-2803] fix: Timeline chart half block dragging #6135: The changes in this PR involve modifications to the getUpdatedPositionAfterDrag method, which is directly related to the changes made in the handleMouseUp function of the useGanttResizable hook, as both involve updating block positions based on drag actions.

Suggested labels

🧹chore

Suggested reviewers

  • sriramveeraghanta
  • SatishGandham

🐰 In the garden where the blocks sway,
A little change brightens the day.
With a flick of the tail and a hop so light,
Resizing made simple, oh what a delight!
Errors now whisper, not shout in dismay,
Hooray for the tweaks that come our way! 🌼


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c7893c5 and 32268bf.

📒 Files selected for processing (1)
  • web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts (3 hunks)
🔇 Additional comments (3)
web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts (3)

3-3: LGTM!

The import of setToast and TOAST_TYPE is correctly structured and necessary for the enhanced error handling.


122-129: Error handling has been properly implemented.

The changes correctly implement the error handling with proper toast notification, addressing the critical bug from the previous review.


106-106: Verify the impact of removing the dragDirection parameter.

The removal of the dragDirection !== "move" parameter from updateBlockPosition aligns with the PR objective. However, we should verify that this change doesn't break any dependency-related functionality.

✅ Verification successful

Removal of dragDirection parameter is correct and safe

The verification shows that the change is consistent with the codebase:

  • The updateBlockPosition function in base-timeline.store.ts is defined with only three parameters: id, deltaLeft, and deltaWidth
  • The function signature in the store interface matches this implementation
  • The usage in use-gantt-resizable.ts correctly calls the function with these three parameters
  • No instances of shouldIgnoreDependencies were found, confirming the removal of dependency-related flags
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other usages of updateBlockPosition to ensure consistency
ast-grep --pattern 'updateBlockPosition($$$)'

# Search for any remaining shouldIgnoreDependencies flags
rg -i 'shouldIgnoreDependencies'

Length of output: 252


Script:

#!/bin/bash
# Let's try to find the definition and usage of updateBlockPosition
ast-grep --pattern 'function updateBlockPosition($$$)'

# Also search for the function declaration in different formats
ast-grep --pattern 'const updateBlockPosition = ($$$)'

# Let's also search for any text containing updateBlockPosition
rg "updateBlockPosition" -A 3 -B 3

Length of output: 3157


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Experiment)
  • @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.

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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1b92a18 and c7893c5.

📒 Files selected for processing (1)
  • web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts (2 hunks)
🔇 Additional comments (1)
web/core/components/gantt-chart/helpers/blockResizables/use-gantt-resizable.ts (1)

106-106: Verify dependency handling during block dragging

The removal of the dependency-ignoring parameter means dependencies will always be considered during dragging operations. This could affect the behavior of connected tasks in the Gantt chart.

Let's verify if this change is consistently applied:

✅ Verification successful

Let me search for more context about the updateBlockPosition function to understand its implementation and usage better.


Let me check the implementation of getUpdatedPositionAfterDrag since it was also mentioned in the original changes.


Based on the gathered evidence, I can now provide the final response:

Changes to dependency handling are consistently applied

The removal of the ignoreDependencies parameter is consistently implemented across the codebase:

  • In base-timeline.store.ts, updateBlockPosition method signature shows the parameter was removed
  • In base-timeline.store.ts, getUpdatedPositionAfterDrag implementation also shows the parameter was removed
  • The only usage of updateBlockPosition in use-gantt-resizable.ts has been updated accordingly
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other occurrences of updateBlockPosition to ensure consistent behavior
ast-grep --pattern 'updateBlockPosition($$$)'

Length of output: 219


Script:

#!/bin/bash
# Search for the definition and usage of updateBlockPosition
ast-grep --pattern 'const updateBlockPosition = $_'

# Also search for any string containing updateBlockPosition to catch other patterns
rg "updateBlockPosition" -A 3

Length of output: 1927


Script:

#!/bin/bash
# Search for getUpdatedPositionAfterDrag implementation and usage
ast-grep --pattern 'getUpdatedPositionAfterDrag($$$)'

# Also search for any string containing getUpdatedPositionAfterDrag
rg "getUpdatedPositionAfterDrag" -A 5

Length of output: 2822

@pushya22 pushya22 merged commit 5a9ae66 into preview Dec 11, 2024
12 of 14 checks passed
@pushya22 pushya22 deleted the chore-enable-dependency-dragging branch December 11, 2024 08:14
nishantPFM pushed a commit to Pocket-Fm/plane that referenced this pull request Dec 12, 2024
…ne view (makeplane#6150)

* remove shouldEnable dependency flags for timeline view

* chore: error handling

---------

Co-authored-by: Prateek Shourya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛bug Something isn't working 🌐frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants