Skip to content

Conversation

@RaenonX
Copy link
Contributor

@RaenonX RaenonX commented Dec 10, 2025

image

Fills the slug using the same old generator function, but now allows the user to edit that field for custom slug.

This also added pm2.yml in .gitignore for production setup.

@vercel
Copy link

vercel bot commented Dec 10, 2025

@RaenonX is attempting to deploy a commit to the umami-software Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 10, 2025

Greptile Overview

Greptile Summary

This PR enhances the link creation functionality by allowing users to create custom slugs for their links instead of being limited to auto-generated ones. The main change is in LinkEditForm.tsx where the slug field is transformed from a hidden, read-only field to an editable input with proper form integration. The component now uses react-hook-form's built-in state management (watch and setValue) instead of maintaining separate slug state with useState and useEffect. Users can either type their own custom slug or use the refresh button to generate a new random slug. The form intelligently uses existing data when editing links or the default generated slug for new links. Additionally, the PR adds pm2.yml to .gitignore to exclude PM2 process manager configuration files from version control, which is a standard practice for production deployments.

Important Files Changed

Filename Score Overview
.gitignore 5/5 Added pm2.yml to ignore PM2 production configuration files
src/app/(main)/links/LinkEditForm.tsx 4/5 Refactored to enable custom slug editing with form integration and improved UX

Confidence score: 4/5

  • This PR is safe to merge with minor considerations around form validation and user experience
  • Score reflects solid implementation with good form integration, but could benefit from slug validation to prevent conflicts or invalid characters
  • Pay close attention to src/app/(main)/links/LinkEditForm.tsx for potential edge cases around duplicate slugs and input validation

Sequence Diagram

sequenceDiagram
    participant User
    participant LinkEditForm
    participant Form
    participant API
    participant Database

    User->>LinkEditForm: "Opens link edit form"
    LinkEditForm->>LinkEditForm: "Generate default slug"
    LinkEditForm->>API: "Load existing link data (if linkId exists)"
    API->>Database: "Query link by ID"
    Database->>API: "Return link data"
    API->>LinkEditForm: "Return link data"
    LinkEditForm->>Form: "Initialize form with default/existing values"
    Form->>User: "Display form with fields (name, url, slug)"
    
    alt User generates new slug
        User->>LinkEditForm: "Click refresh button"
        LinkEditForm->>LinkEditForm: "Generate new slug"
        LinkEditForm->>Form: "Update slug field"
        Form->>User: "Show updated slug"
    end
    
    User->>Form: "Fill form fields and submit"
    Form->>LinkEditForm: "Validate form data"
    LinkEditForm->>LinkEditForm: "Check URL validity"
    
    alt Valid form data
        LinkEditForm->>API: "Submit link data (POST/PUT)"
        API->>Database: "Create/update link record"
        Database->>API: "Confirm operation"
        API->>LinkEditForm: "Return success response"
        LinkEditForm->>User: "Show success toast message"
        LinkEditForm->>LinkEditForm: "Call onSave and onClose callbacks"
    else Invalid form data
        LinkEditForm->>User: "Display validation errors"
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant