Skip to content

[WEB-2110] fix: broken link while trying to copy page link#5263

Merged
SatishGandham merged 1 commit intopreviewfrom
fix/page-link
Jul 30, 2024
Merged

[WEB-2110] fix: broken link while trying to copy page link#5263
SatishGandham merged 1 commit intopreviewfrom
fix/page-link

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Jul 30, 2024

Problem:

When trying to copy a page link from the options dropdown inside a page, projectId comes as undefined.

Solution:

Add project information to the page link only if the projectId is present in the params.

Plane issue: WEB-2110

Summary by CodeRabbit

  • New Features
    • Enhanced the Page Options Dropdown to generate valid URLs for copying page links, accommodating scenarios without a project ID.
  • Bug Fixes
    • Improved the logic for URL construction to ensure proper handling of undefined project IDs, thus enhancing the overall user experience.

@aaryan610 aaryan610 added 🐛bug Something isn't working 🌐frontend labels Jul 30, 2024
@aaryan610 aaryan610 added this to the v0.23-dev milestone Jul 30, 2024
@aaryan610 aaryan610 requested a review from SatishGandham July 30, 2024 07:12
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 30, 2024

Walkthrough

The update to the PageOptionsDropdown component enhances URL generation for copying page links. The logic now checks for the presence of projectId before constructing the URL, ensuring it accommodates both scenarios—when projectId is defined or undefined. This improvement increases the component's adaptability and reinforces a positive user experience by providing more accurate link structures.

Changes

Files Change Summary
web/core/components/pages/editor/header/options-dropdown.tsx Updated URL construction logic in PageOptionsDropdown to conditionally include projectId, enhancing flexibility for link handling.

Poem

🐇 In the meadow where changes bloom,
A dropdown danced, dispelling gloom.
With each URL crafted just right,
Links now shine, oh what a sight!
Hopping forth with joy anew,
Here’s to changes, fresh and true! 🌼✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 35e58e9 and a02839d.

Files selected for processing (1)
  • web/core/components/pages/editor/header/options-dropdown.tsx (1 hunks)
Additional comments not posted (1)
web/core/components/pages/editor/header/options-dropdown.tsx (1)

111-113: LGTM! But verify the correctness of projectId handling.

The code changes are approved.

However, ensure that the projectId is correctly handled and that the constructed URLs are valid.

Verification successful

LGTM! The projectId is handled correctly and the constructed URLs are valid.

The code changes are approved.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the correctness of `projectId` handling.

# Test: Search for the `useParams` hook usage. Expect: Correct handling of `projectId`.
rg --type tsx -A 5 $'useParams'

Length of output: 58


Script:

#!/bin/bash
# Description: Verify the correctness of `projectId` handling.

# Test: Search for the `useParams` hook usage. Expect: Correct handling of `projectId`.
rg --type ts -A 5 'useParams'

Length of output: 336127

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.

2 participants