]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor(webui): remove redundant optimistic fetch from modern skin
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 2 May 2026 21:08:50 +0000 (23:08 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 2 May 2026 21:08:50 +0000 (23:08 +0200)
Rely solely on server push (ServerNotification.REFRESH) for data refresh
after user actions, eliminating the duplicate getChargingStations() call
that was triggered via the need-refresh event chain.

ui/web/src/shared/composables/useAsyncAction.ts
ui/web/src/skins/modern/ModernLayout.vue
ui/web/src/skins/modern/components/ConnectorRow.vue
ui/web/src/skins/modern/components/StationCard.vue

index 12398a495f4dba1928556f61449f2bdadded55c8..04ca14cc1a3b9b9f52ac223c38e807be53f98041 100644 (file)
@@ -11,7 +11,7 @@ import { useToast } from 'vue-toast-notification'
  * Encapsulates the pending-key guard, toast feedback, and error logging pattern
  * shared across layout composables.
  * @param initialPending - Object defining the pending keys (e.g. `{ connection: false, startStop: false }`)
- * @param onRefresh - Called after each successful action (e.g. `() => emit('need-refresh')`)
+ * @param onRefresh - Called after each successful action to signal state has changed
  * @returns `{ pending, run }` — reactive pending map and action executor
  */
 export function useAsyncAction<T extends Record<string, boolean>> (
index e9f2a0c7c4cb3141fe4f7f10e632d2d10c8fd422..949ac6c95f1c5a6d12d9674867d720cdf86538d5 100644 (file)
@@ -31,7 +31,6 @@
         v-for="station in $chargingStations"
         :key="station.stationInfo.hashId"
         :charging-station="station"
-        @need-refresh="getChargingStations"
         @open-authorize="openAuthorizeDialog"
         @open-set-url="openSetUrlDialog"
         @open-start-tx="openStartTxDialog"
@@ -125,7 +124,7 @@ const StartTransactionDialog = defineAsyncDialog(
 const $chargingStations = useChargingStations()
 
 const layoutData = useLayoutData()
-const { getChargingStations, simulatorState, uiServerConfigurations } = layoutData
+const { simulatorState, uiServerConfigurations } = layoutData
 
 const uiServerIndex = ref(getFromLocalStorage<number>(UI_SERVER_CONFIGURATION_INDEX_KEY, 0))
 
index e7518336a6f1d06ced77d40f14e131bca0f76f5c..f24fd1bcf771248333545168e705e28e42fc9ee2 100644 (file)
@@ -176,7 +176,6 @@ const props = defineProps<{
 }>()
 
 const emit = defineEmits<{
-  'need-refresh': []
   'open-start-tx': [
     data: {
       chargingStationId: string
@@ -198,7 +197,6 @@ const {
 } = useConnectorActions({
   connectorId: computed(() => props.connectorId),
   hashId: computed(() => props.hashId),
-  onRefresh: () => emit('need-refresh'),
 })
 
 const identifier = computed(() =>
index d874cf395ac7be731bd26e107451f50ae8618cc8..3fd17d98d68b1cecff37db3a6ed1d2d78ae75b5c 100644 (file)
           :evse-id="entry.evseId"
           :hash-id="chargingStation.stationInfo.hashId"
           :ocpp-version="chargingStation.stationInfo.ocppVersion"
-          @need-refresh="$emit('need-refresh')"
           @open-start-tx="data => $emit('open-start-tx', data)"
         />
       </div>
@@ -187,7 +186,6 @@ const props = defineProps<{
 }>()
 
 const emit = defineEmits<{
-  'need-refresh': []
   'open-authorize': [data: { chargingStationId: string; hashId: string; ocppVersion?: OCPPVersion }]
   'open-set-url': [data: { chargingStationId: string; hashId: string }]
   'open-start-tx': [
@@ -204,7 +202,7 @@ const emit = defineEmits<{
 const confirmingDelete = ref(false)
 
 const { closeConnection, deleteStation, openConnection, pending, startStation, stopStation } =
-  useStationActions({ onRefresh: () => emit('need-refresh') })
+  useStationActions()
 
 const wsOpen = computed(() => props.chargingStation.wsState === WebSocketReadyState.OPEN)