Skip to content

Conversation

@tomerqodo
Copy link

Benchmark PR appsmithorg#41312

Type: Corrupted (contains bugs)

Original PR Title: feat: Static URL Support for Applications and Pages
Original PR Description: ## 🎯 Overview
This PR implements Static URL functionality for Appsmith applications and pages, allowing users to create clean, URLs without auto-generated IDs. This feature is gated behind the release_static_url_enabled feature flag.

🚀 Key Features

1. Application-Level Static URLs

  • Enable/Disable Static URLs: Toggle static URLs on/off at the application level
  • Custom Application Slug: Set a unique, human-readable slug for the entire application (e.g., my-app instead of untitled-application-5)
  • Real-time Validation: Client-side and server-side validation for slug format (lowercase letters, numbers, hyphens only)
  • Availability Check: Real-time checking if a slug is available or already taken
  • Slug Suggestions: Auto-generate slug suggestions based on application name

2. Page-Level Static URLs

  • Custom Page Slugs: Set unique slugs for individual pages (e.g., dashboard instead of page1-68fb0a086001f8101c93e34q)
  • Per-Page Configuration: Each page can have its own static slug
  • Validation & Uniqueness: Real-time validation and uniqueness checking for page slugs

3. URL Format Changes

Before (Legacy Format):

/app/application-slug/page-name-<pageId>

After (Static URL Format):

/app/app-slug/page-slug

🏗️ Technical Implementation

New Routes

  • BUILDER_PATH_STATIC: /app/:staticApplicationSlug/:staticPageSlug/edit
  • VIEWER_PATH_STATIC: /app/:staticApplicationSlug/:staticPageSlug

New Redux Actions

  • ENABLE_STATIC_URL / DISABLE_STATIC_URL: Toggle static URL feature
  • PERSIST_APP_SLUG / PERSIST_PAGE_SLUG: Save application/page slugs
  • VALIDATE_APP_SLUG / VALIDATE_PAGE_SLUG: Validate slug availability
  • FETCH_APP_SLUG_SUGGESTION: Get auto-generated suggestions

New API Endpoints

Application APIs

  • POST /api/v1/applications/:applicationId/static-url - Enable static URL with initial slug
  • PUT /api/v1/applications/:applicationId/static-url - Update application slug
  • DELETE /api/v1/applications/:applicationId/static-url - Disable static URL
  • GET /api/v1/applications/:applicationId/static-url/:uniqueSlug - Validate application slug availability
  • GET /api/v1/applications/:applicationId/static-url/suggest-app-slug - Get slug suggestion

Page APIs

  • PATCH /api/v1/pages/static-url - Update page slug
  • GET /api/v1/pages/:pageId/static-url/verify/:uniqueSlug - Validate page slug availability

URL Assembly Enhancements

  • Extended URLAssembly to support static URL generation
  • Added URL_TYPE.STATIC for static URL routing
  • Static URLs only apply in published/viewer mode (edit mode uses regular URLs)
  • Automatic fallback: If staticPageSlug is not set, falls back to regular pageSlug

🎨 UI Components

General Settings (Application Level)

  • Static URL Toggle: Enable/disable static URLs for the application
  • Application Slug Input:
    • Real-time validation with error messages
    • Loading states during validation
    • Success/error indicators
    • URL preview showing the final URL
  • Apply/Cancel Buttons: Persist or discard changes
  • Confirmation Modal: Shows before/after URLs when changing or disabling

Page Settings (Page Level)

  • Page Slug Input: Similar to application slug with validation
  • URL Preview: Shows the complete page URL
  • Apply/Cancel Actions: Per-page slug management

StaticURLConfirmationModal

  • Displays "From" and "To" URLs
  • Warning message about breaking existing links
  • Different modes: "Change" vs "Disable"
  • Bold formatting for app/page slugs in URLs

🔄 State Management

Application Reducer

  • uniqueSlug: Stores the application's static slug
  • staticUrlEnabled: Boolean flag for static URL status

Page List Reducer

  • uniqueSlug: Stores each page's static slug
  • Updates only the specific page when slug is persisted

Applications UI Reducer

  • isValidatingAppSlug: Validation in progress
  • isApplicationSlugValid: Validation result
  • isFetchingAppSlugSuggestion: Fetching suggestion
  • appSlugSuggestion: Auto-generated suggestion
  • isPersistingAppSlug: Save in progress

🛡️ Validation Rules

Application/Page Slug Requirements:

  • Only lowercase letters (a-z)
  • Numbers (0-9)
  • Hyphens (-)
  • No spaces or special characters
  • Must be unique across the workspace
  • Cannot be empty

🔀 Navigation & Routing

Route Matching Updates

  • Extended matchBuilderPath to include BUILDER_PATH_STATIC
  • Extended matchViewerPath to include VIEWER_PATH_STATIC
  • Updated route params to include optional staticApplicationSlug and staticPageSlug

Page Navigation

  • New hook: useStaticUrlGeneration for generating static URLs in navigation
  • Updated useNavigateToAnotherPage to support static URLs
  • Menu items and navigation components updated to use static URLs when available

📦 Key Files Changed

Core Logic:

  • URLAssembly.ts: URL generation logic with static URL support
  • ApplicationSagas.tsx: Sagas for enable/disable/persist operations
  • PageSagas.tsx: Page-level slug persistence
  • appRoutes.ts: New static URL routes

UI Components:

  • GeneralSettings.tsx: Application-level static URL configuration
  • PageSettings.tsx: Page-level static URL configuration
  • StaticURLConfirmationModal.tsx: Confirmation dialog (new)
  • UrlPreview.tsx: URL preview component (new)

State Management:

  • applicationsReducer.tsx: Application UI state
  • appReducer.ts: Application entity state
  • pageListReducer.tsx: Page list state

⚙️ Feature Flag

  • release_static_url_enabled: Controls visibility of static URL features

Automation

/ok-to-test tags="@tag.All"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/18936467359
Commit: a74b4ac
Cypress dashboard.
Tags: @tag.All
Spec:


Thu, 30 Oct 2025 10:56:15 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Static URL support for apps and pages: enable/disable static URLs, edit app/page slugs, validate and persist slugs, and receive slug suggestions.
    • URL preview with click-to-copy and a confirmation modal when changing or disabling app slugs.
  • Bug Fixes / Improvements

    • Routing, editor and viewer flows updated for slug-based paths.
    • Base page resolution and editor links now derive from application state for more reliable navigation and loading.

Original PR URL: appsmithorg#41312

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.

4 participants