[WEB-3797] fix: remove leading slash from URL to copy#6890
[WEB-3797] fix: remove leading slash from URL to copy#6890sriramveeraghanta merged 2 commits intopreviewfrom
Conversation
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
WalkthroughThis update consolidates the implementation of the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Component
participant ClipboardUtil as copyUrlToClipboard
participant ClipboardAPI
User->>Component: Trigger copy URL action
Component->>ClipboardUtil: Call copyUrlToClipboard(workItemLink)
ClipboardUtil->>ClipboardAPI: Copy full URL <originUrl + workItemLink>
ClipboardAPI-->>ClipboardUtil: Copy confirmation
ClipboardUtil-->>Component: Return success status
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/utils/src/string.ts (1)
90-90: Improved URL handling to prevent double slashes.The added code properly removes leading slashes from paths, ensuring correct URL formation when concatenated with the origin. This fixes the issue mentioned in the PR objectives.
Consider adding a null/empty check before accessing
path[0]to make the function more robust:- if (path[0] === "/") path = path.slice(1); + if (path && path.length > 0 && path[0] === "/") path = path.slice(1);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
packages/utils/src/string.ts(1 hunks)web/core/components/issues/create-issue-toast-action-items.tsx(2 hunks)web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx(2 hunks)web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx(2 hunks)web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx(2 hunks)web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx(2 hunks)web/core/components/issues/peek-overview/header.tsx(2 hunks)web/core/hooks/use-page-operations.ts(1 hunks)web/helpers/string.helper.ts(0 hunks)
💤 Files with no reviewable changes (1)
- web/helpers/string.helper.ts
🧰 Additional context used
🧬 Code Definitions (5)
web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx (1)
packages/utils/src/string.ts (1)
copyUrlToClipboard(88-92)
web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx (1)
packages/utils/src/string.ts (1)
copyUrlToClipboard(88-92)
web/core/components/issues/create-issue-toast-action-items.tsx (1)
packages/utils/src/string.ts (1)
copyUrlToClipboard(88-92)
web/core/components/issues/peek-overview/header.tsx (1)
packages/utils/src/string.ts (1)
copyUrlToClipboard(88-92)
web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx (1)
packages/utils/src/string.ts (1)
copyUrlToClipboard(88-92)
🔇 Additional comments (15)
web/core/hooks/use-page-operations.ts (1)
2-2: Import update and comment correction.The import for
copyUrlToClipboardhas been correctly updated to the new central location in@plane/utils, and the comment has been changed from "plane constants" to "plane imports" to better reflect the import section content.Also applies to: 7-7
web/core/components/issues/issue-layouts/quick-action-dropdowns/cycle-issue.tsx (2)
8-12: Updated import sources for Plane utilities.The import for
copyUrlToClipboardhas been correctly relocated from the local helper to the central@plane/utilspackage.
71-72: Simplified function call to match updated API.The second parameter has been removed from the
copyUrlToClipboardcall, aligning with the new implementation in@plane/utilsthat only requires the path parameter.web/core/components/issues/issue-layouts/quick-action-dropdowns/project-issue.tsx (2)
8-13: Updated import sources for Plane utilities.The import for
copyUrlToClipboardhas been correctly relocated from the local helper to the central@plane/utilspackage.
76-77: Simplified function call to match updated API.The second parameter has been removed from the
copyUrlToClipboardcall, aligning with the new implementation in@plane/utilsthat only requires the path parameter.web/core/components/issues/peek-overview/header.tsx (2)
21-21: Import path updated correctly.The import of
copyUrlToClipboardhas been properly updated to use the centralized version from@plane/utilsrather than the local helper. This aligns with the PR's goal of consolidating utility functions.
110-110: Function call updated correctly.The second parameter has been removed from the
copyUrlToClipboardfunction call, which matches the new function signature in the utils package. The new implementation correctly handles paths with leading slashes internally.web/core/components/issues/issue-layouts/quick-action-dropdowns/module-issue.tsx (3)
8-9: Comment organization improved.The comment has been appropriately updated from "// types" to "// plane imports" to better reflect the nature of the imports that follow it.
12-12: Import path updated correctly.The import of
copyUrlToClipboardhas been properly updated to use the centralized version from@plane/utilsrather than the local helper, aligning with the PR's objective.
71-72: Function call updated correctly.The second parameter has been removed from the
copyUrlToClipboardfunction call, which aligns with the updated function signature in the utils package. The new implementation in@plane/utilsnow handles leading slashes within the function itself.web/core/components/issues/issue-layouts/quick-action-dropdowns/all-issue.tsx (3)
8-9: Comment organization improved.The comment has been appropriately updated from "// types" to "// plane imports" to better reflect the nature of the imports that follow it.
12-12: Import path updated correctly.The import of
copyUrlToClipboardhas been properly updated to use the centralized version from@plane/utils, which consolidates the utility function as intended in the PR.
63-64: Function call updated correctly.The second parameter has been removed from the
copyUrlToClipboardfunction call, aligning with the new function signature. The updated implementation in the utils package now handles URL paths with leading slashes internally.web/core/components/issues/create-issue-toast-action-items.tsx (2)
4-5: Import restructured correctly.The import has been properly updated to use the standardized
copyUrlToClipboardfrom@plane/utilsand the comment has been updated to "// plane imports" to accurately categorize the import.
45-45: Function call updated correctly.The second parameter has been removed from the
copyUrlToClipboardfunction call, which aligns with the new function signature in the utils package. The updated implementation now handles leading slashes in the URL path internally.
* fix: remove prefix slash if present * chore: make use of URL class to generate a valid URL
Description
This PR updates the
copyURLTpClipboardfunction to handle URLs with a leading slash.Also, this removes the function from web app and updates all of its instances to import it from the utils package.
Type of Change
Summary by CodeRabbit
Bug Fixes
Refactor