pénzügyi modul továbbfejlesztése (csomagkezelés)
This commit is contained in:
@@ -138,7 +138,27 @@ export const useVehicleStore = defineStore('vehicle', () => {
|
||||
* Fetch all vehicles/assets for the current user or their organization.
|
||||
* GET /assets/vehicles
|
||||
*/
|
||||
// P0 BUGFIX (2026-07-28): Deduplication guard to prevent multiple simultaneous
|
||||
// calls from DashboardView.onMounted() and child components.
|
||||
let _vehicleFetchInProgress = false
|
||||
|
||||
/**
|
||||
* P0 BUGFIX (2026-07-28): Context-switching data leak fix.
|
||||
* Clears the local vehicle cache and resets the deduplication guard.
|
||||
* Called by DashboardView before re-fetching after organization switch.
|
||||
*/
|
||||
function clearCache() {
|
||||
_vehicleFetchInProgress = false
|
||||
vehicles.value = []
|
||||
error.value = null
|
||||
}
|
||||
|
||||
async function fetchVehicles() {
|
||||
if (_vehicleFetchInProgress) {
|
||||
// Skip duplicate: a fetch is already in flight
|
||||
return vehicles.value
|
||||
}
|
||||
_vehicleFetchInProgress = true
|
||||
isLoading.value = true
|
||||
error.value = null
|
||||
|
||||
@@ -154,6 +174,7 @@ export const useVehicleStore = defineStore('vehicle', () => {
|
||||
console.error('[VehicleStore] fetchVehicles error:', err)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
_vehicleFetchInProgress = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,6 +454,7 @@ export const useVehicleStore = defineStore('vehicle', () => {
|
||||
sortedVehicles,
|
||||
|
||||
// Actions
|
||||
clearCache,
|
||||
fetchVehicles,
|
||||
fetchVehicleById,
|
||||
createVehicle,
|
||||
|
||||
Reference in New Issue
Block a user