Skip to content

feat: support sub-path deployment for preview URLs#19

Merged
dsfaccini merged 1 commit intomainfrom
sub-path-deployment
Apr 7, 2026
Merged

feat: support sub-path deployment for preview URLs#19
dsfaccini merged 1 commit intomainfrom
sub-path-deployment

Conversation

@dsfaccini
Copy link
Copy Markdown
Contributor

Summary

  • Adds stripBasePath / withBasePath utilities that use import.meta.env.BASE_URL to handle sub-path mounting (e.g. /preview/main/)
  • Wraps all client-side pathname reads/writes so routing works when the app is served at a sub-path
  • When BASE_URL is / (standalone deployment), both functions are identity — zero behavioral change

Changes

  • New: src/lib/base-path.ts — 14-line utility
  • Modified: src/hooks/useConversationIdFromUrl.tsx — strip/prepend base on read/write
  • Modified: src/Chat.tsx — strip base before checking '/', prepend base on new conversation URL
  • Modified: src/components/app-sidebar.tsx — prepend base on sidebar links, strip base in delete comparison

Test plan

  • pnpm run typecheck passes
  • pnpm run lint passes
  • pnpm run build with default config — assets reference / (standalone unchanged)
  • pnpm vite build --base /preview/test/index.html has /preview/test/assets/...
  • pnpm vite preview --base /preview/test/ — app renders and routes correctly at /preview/test/
  • Deploy via webui.pydantic.work to validate end-to-end

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@dsfaccini dsfaccini merged commit 7782ba4 into main Apr 7, 2026
1 check passed
@dsfaccini dsfaccini deleted the sub-path-deployment branch April 7, 2026 01:19
github-actions Bot pushed a commit that referenced this pull request Apr 7, 2026
# [1.2.0](v1.1.0...v1.2.0) (2026-04-07)

### Features

* support sub-path deployment for preview URLs ([#19](#19)) ([7782ba4](7782ba4))
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant