6a62db2e85
Give each conversation a deep-linkable URL (/c/:conversationId) so threads
survive refresh, support browser back/forward, and are shareable within a
session. The app was already an SPA but had no router.
- Add react-router-dom; wrap the app in BrowserRouter and define routes
("/" for the empty/new state, "/c/:conversationId" for a thread)
- Make the URL the source of truth for selection: selectedConversation is
derived from the :conversationId param; create/delete navigate instead of
mutating local selection state
- Load a thread's messages in a URL-keyed effect that clears immediately for
an instant switch, with a stale-response guard
- Preserve the optimistic message + in-flight stream when the first message
lazily creates a conversation and navigates into it (skip-ref keyed on the
new id, guarded against the null/home-route collision)
No backend changes: app.py already serves index.html for unmatched paths.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
49 lines
1.1 KiB
JSON
49 lines
1.1 KiB
JSON
{
|
|
"name": "raggr-frontend",
|
|
"version": "1.0.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"build": "rsbuild build",
|
|
"dev": "rsbuild dev --open",
|
|
"preview": "rsbuild preview",
|
|
"watch": "npm-watch build",
|
|
"watch:build": "rsbuild build --watch"
|
|
},
|
|
"dependencies": {
|
|
"axios": "^1.12.2",
|
|
"class-variance-authority": "^0.7.1",
|
|
"clsx": "^2.1.1",
|
|
"lucide-react": "^0.577.0",
|
|
"marked": "^16.3.0",
|
|
"npm-watch": "^0.13.0",
|
|
"react": "^19.1.1",
|
|
"react-dom": "^19.1.1",
|
|
"react-markdown": "^10.1.0",
|
|
"react-router-dom": "^7.18.3",
|
|
"remark-gfm": "^4.0.1",
|
|
"tailwind-merge": "^3.5.0",
|
|
"watch": "^1.0.2"
|
|
},
|
|
"devDependencies": {
|
|
"@biomejs/biome": "2.3.10",
|
|
"@rsbuild/core": "^1.5.6",
|
|
"@rsbuild/plugin-react": "^1.4.0",
|
|
"@tailwindcss/postcss": "^4.0.0",
|
|
"@types/react": "^19.1.13",
|
|
"@types/react-dom": "^19.1.9",
|
|
"typescript": "^5.9.2"
|
|
},
|
|
"watch": {
|
|
"build": {
|
|
"patterns": [
|
|
"src"
|
|
],
|
|
"extensions": "ts,tsx,css,js,jsx",
|
|
"delay": 1000,
|
|
"quiet": false,
|
|
"inherit": true
|
|
}
|
|
}
|
|
}
|