Fix blank page issue on module route refresh

- Pre-register all module routes automatically from module definitions in router configuration
- Add useModuleReady composable for clean reactive loading states during module initialization
- Update ChatPage and EventsPage with proper loading/error states and computed service access
- Remove duplicate route registration from plugin manager install phase
- Maintain modular architecture while ensuring routes are available immediately on app startup

Resolves blank pages and Vue Router warnings when refreshing on /chat, /events, /my-tickets routes.
Users now see proper loading indicators instead of blank screens during module initialization.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
padreug 2025-09-06 16:33:32 +02:00
parent 85635cfc96
commit 7145af3f83
5 changed files with 140 additions and 15 deletions

View file

@ -34,11 +34,21 @@ export async function createAppInstance() {
// Create Vue app
const app = createApp(App)
// Create router
// Collect all module routes automatically to avoid duplication
const moduleRoutes = [
// Extract routes from modules directly
...baseModule.routes || [],
...nostrFeedModule.routes || [],
...chatModule.routes || [],
...eventsModule.routes || [],
...marketModule.routes || []
].filter(Boolean)
// Create router with all routes available immediately
const router = createRouter({
history: createWebHistory(),
routes: [
// Default route - will be populated by modules
// Default routes
{
path: '/',
name: 'home',
@ -50,7 +60,9 @@ export async function createAppInstance() {
name: 'login',
component: () => import('./pages/LoginDemo.vue'),
meta: { requiresAuth: false }
}
},
// Pre-register module routes
...moduleRoutes
]
})