[WEB-2221] fix: app sidebar and favorites improvement#5357
[WEB-2221] fix: app sidebar and favorites improvement#5357SatishGandham merged 4 commits intopreviewfrom
Conversation
WalkthroughThe recent updates enhance the interactivity and functionality of components related to favorites and projects. Key improvements include the addition of a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant FavoriteItemTitle
participant Helper
participant DOM
User->>FavoriteItemTitle: Click on favorite item
FavoriteItemTitle->>Helper: Call handleOnClick with projectId
Helper->>DOM: Scroll to element with projectId
DOM-->>User: Element scrolled into view
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? 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 as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-title.tsx (1 hunks)
- web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx (1 hunks)
- web/core/components/workspace/sidebar/favorites/favorite-items/root.tsx (1 hunks)
- web/core/components/workspace/sidebar/projects-list-item.tsx (2 hunks)
Additional comments not posted (4)
web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx (1)
47-47: LGTM! The URL generation logic is flexible and correct.The conditional check for the
entityPathensures that issue links are generated without anentity_identifier, which is a good improvement.web/core/components/workspace/sidebar/favorites/favorite-items/root.tsx (1)
93-99: LGTM! The addition ofprojectIdenhances functionality.The
projectIdprop allowsFavoriteItemTitleto handle project-specific logic, aligning with the PR's objectives.web/core/components/workspace/sidebar/projects-list-item.tsx (2)
270-273: LGTM! Improved URL responsiveness.The updated
useEffecthook correctly manages theisProjectListOpenstate based on the URL, enhancing the component's responsiveness to URL changes.
295-295: LGTM! Enhanced element identification.The addition of an
idattribute withproject.idimproves the ability to identify and manipulate the element in the DOM.
| const handleOnClick = () => { | ||
| if (projectId) { | ||
| const projectItem = document.getElementById(`${projectId}`); | ||
| projectItem?.scrollIntoView({ behavior: "smooth" }); | ||
| } | ||
| }; |
There was a problem hiding this comment.
Consider using React refs or state management instead of document.getElementById.
The use of document.getElementById is generally discouraged in React as it bypasses the React virtual DOM. Consider using React refs or state management to handle DOM interactions for better integration with React's lifecycle.
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- web/core/hooks/use-favorite-item-details.tsx (2 hunks)
Additional comments not posted (2)
web/core/hooks/use-favorite-item-details.tsx (2)
16-16: Good use of dynamic project fetching.The change from
currentProjectDetailstogetProjectByIdallows for more dynamic and flexible retrieval of project details.
26-27: Dynamic project details retrieval implemented.Assigning
currentProjectDetailsusinggetProjectById(favorite.project_id ?? "")ensures that project details are dynamically fetched based on the favorite item's project ID.
Changes:
This PR includes the following updates to the app sidebar:
Reference:
[WEB-2221]
Summary by CodeRabbit
New Features
Bug Fixes