Skip to content

[WEB-3853] fix: untitled page name issue#6918

Merged
sriramveeraghanta merged 1 commit intopreviewfrom
fix-page_switcher_title
Apr 11, 2025
Merged

[WEB-3853] fix: untitled page name issue#6918
sriramveeraghanta merged 1 commit intopreviewfrom
fix-page_switcher_title

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Apr 11, 2025

Description

This update fixes the page name at switcher when the page title is 'Untitled'

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

WEB-3853

Summary by CodeRabbit

  • New Features
    • Enhanced the project details header with refined page name presentation for a more consistent and clear display. Users will now experience uniform labeling that improves readability and interface polish. This update provides a smoother and more reliable viewing experience on all project-related pages.

@vamsikrishnamathala vamsikrishnamathala added the 🐛bug Something isn't working label Apr 11, 2025
@vamsikrishnamathala vamsikrishnamathala self-assigned this Apr 11, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 11, 2025

Walkthrough

The changes modify the way page names are displayed within the header component by introducing a new helper function. The PageDetailsHeader component now imports getPageName from the helper module, using it to format the page name when passing props to the SwitcherLabel and CustomSearchSelect components. The overall structure remains the same, with only the display logic for page names being updated.

Changes

File(s) Change Summary
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx Updated two instances where the page name is used; now calling getPageName(_page.name) for the SwitcherLabel content and CustomSearchSelect label prop.
@/helpers/page.helper Added and exported the new getPageName method to format page names.

Sequence Diagram(s)

sequenceDiagram
    participant H as Header Component
    participant G as getPageName Helper
    participant S as UI Component (SwitcherLabel/CustomSearchSelect)
    
    H->>G: Call getPageName(_page.name)
    G-->>H: Return formatted name
    H->>S: Pass formatted name as prop
Loading

Poem

I'm a rabbit on a coding spree,
Hopping through changes quite merrily.
A helper called, and names reform,
Bringing order in a gentle swarm.
With ASCII hops and joyful cheer,
CodeRabbit leaps into the new frontier!

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 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 4c688b1 and 97d9948.

📒 Files selected for processing (1)
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx (1)
web/core/components/common/switcher-label.tsx (1)
  • SwitcherLabel (13-27)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (4)
web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/pages/(detail)/header.tsx (4)

16-16: Good addition of helper function import for consistent page name handling.

The introduction of the getPageName helper function is a well-structured approach to solve the "Untitled page name" issue.


114-116: Consistent application of the page name helper.

Good job consistently applying the getPageName helper function to the label prop of the CustomSearchSelect component. This ensures that page names are displayed uniformly throughout the interface.


1-131:

Details

❓ Verification inconclusive

Verify the helper function's implementation handles all edge cases.

While the usage of getPageName is correct, it would be beneficial to verify that the helper function properly handles all edge cases (null, undefined, empty strings, etc.).


🏁 Script executed:

#!/bin/bash
# Let's examine the implementation of getPageName function
if [ -f "web/helpers/page.helper.ts" ]; then
    cat "web/helpers/page.helper.ts"
elif [ -f "web/helpers/page.helper.tsx" ]; then
    cat "web/helpers/page.helper.tsx"
else
    # Search for the file if it's not in the expected location
    echo "Searching for page.helper file..."
    fd "page\.helper\.(ts|tsx)$" web
fi

Length of output: 3142


Verify and clarify edge-case behavior in getPageName

After reviewing the implementation in web/helpers/page.helper.ts, it appears that:

  • When name is undefined, the function returns an empty string ("").
  • When name is an empty or whitespace-only string, the function returns "Untitled".

Please verify whether this difference is intentional. If the design aims for uniformity in handling “missing” names (i.e. treating both undefined and empty strings as absent), consider updating the function or adding a comment to document the intended behavior.


65-65:

Details

✅ Verification successful

Appropriate implementation of page name formatting in switcher options.

The change correctly applies the getPageName helper to format the page name in the switcher options, which should prevent the "Untitled" display issue when page titles aren't set.


🏁 Script executed:

#!/bin/bash
# Verify if getPageName is consistently used for all page name displays in the codebase
rg "page\.name(?!\s*\))" --type=tsx --type=jsx -g "!node_modules" -g "!**/header.tsx"

Length of output: 320


#!/bin/bash
# Re-run with PCRE2 enabled to verify if any references to `page.name` are not formatted using the getPageName helper
rg --pcre2 "page\.name(?!\s*\))" --type=tsx --type=jsx -g "!node_modules" -g "!**/header.tsx"

Page Name Formatting Validated

The implementation correctly applies the getPageName helper in the switcher options, ensuring that issues like "Untitled" for unset page names are avoided. A re-run of the search (with PCRE2 enabled) did not reveal any inconsistent usage of page.name elsewhere in the codebase (excluding header.tsx), confirming that the formatted approach is applied consistently.

✨ 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.
    • 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@makeplane
Copy link

makeplane bot commented Apr 11, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@sriramveeraghanta sriramveeraghanta changed the title [WEB-3853]fix: untitled page name issue [WEB-3853] fix: untitled page name issue Apr 11, 2025
@sriramveeraghanta sriramveeraghanta merged commit 1d5b93c into preview Apr 11, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix-page_switcher_title branch April 11, 2025 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants