From d329336020404e557dc48d01c0601d690103ada5 Mon Sep 17 00:00:00 2001 From: Hanzo_dev <2002samudiojohan@gmail.com> Date: Thu, 26 Feb 2026 09:09:25 -0500 Subject: [PATCH] perf: optimize splash screen loading and remove unused telemetry code --- frontend/src/views/AdminRoutes.vue | 8 ++++++-- frontend/src/views/MapView.vue | 9 +++++---- frontend/src/views/ProfileView.vue | 8 ++------ frontend/src/views/SplashScreen.vue | 26 ++++++++++++++++++-------- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/frontend/src/views/AdminRoutes.vue b/frontend/src/views/AdminRoutes.vue index 924ed26..8fe2ce8 100644 --- a/frontend/src/views/AdminRoutes.vue +++ b/frontend/src/views/AdminRoutes.vue @@ -206,8 +206,12 @@ onMounted(async () => { }) async function loadInitialData() { - routes.value = await routesService.getAllRoutes() - allStops.value = await busStopsService.getAllBusStops() + const [routesData, stopsData] = await Promise.all([ + routesService.getAllRoutes(), + busStopsService.getAllBusStops() + ]) + routes.value = routesData + allStops.value = stopsData } const availableStops = computed(() => { diff --git a/frontend/src/views/MapView.vue b/frontend/src/views/MapView.vue index 3a86302..40d988a 100644 --- a/frontend/src/views/MapView.vue +++ b/frontend/src/views/MapView.vue @@ -7,7 +7,6 @@ import { useMapStore } from "@/stores/map"; import { useBusStopStore } from "@/stores/busStop"; import { useCouponStore } from "@/stores/coupon"; import { useGoogleMaps } from "@/composables/useGoogleMaps"; -import { telemetryService } from "@/services/telemetryService"; import { analyticsService } from "@/services/analyticsService"; import { getImageUrl } from "@/utils/imageUrl"; @@ -212,9 +211,11 @@ onMounted(async () => { // Add click outside listener document.addEventListener('click', handleClickOutside); - // Load routes, bus stops and promos - await routeStore.loadRoutes(); - await couponStore.loadCoupons({ active_only: true }); + // Load routes, bus stops and promos in parallel + await Promise.all([ + routeStore.loadRoutes(), + couponStore.loadCoupons({ active_only: true }) + ]); // Sync from query params if coming from Schedules or external link const queryRouteId = router.currentRoute.value.query.routeId as string; diff --git a/frontend/src/views/ProfileView.vue b/frontend/src/views/ProfileView.vue index 95a19a7..c547a05 100644 --- a/frontend/src/views/ProfileView.vue +++ b/frontend/src/views/ProfileView.vue @@ -3,6 +3,7 @@ import { ref, onMounted } from 'vue' import { useRouter } from 'vue-router' import { useCouponStore } from '@/stores/coupon' import { authService } from '@/services/authService' +import { getImageUrl } from '@/utils/imageUrl' const router = useRouter() const couponStore = useCouponStore() @@ -105,12 +106,7 @@ function getStatusLabel(status: string) { } } -const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000' -function getFullUrl(path: string) { - if (!path) return '' - if (path.startsWith('http')) return path - return `${API_URL}${path}` -} +const getFullUrl = (path: string) => getImageUrl(path)