Skip to content

Commit

Permalink
add partial patches to time entries store after time entry updates to…
Browse files Browse the repository at this point in the history
… avoid inconsistencies , fixes ST-259
  • Loading branch information
Onatcer committed Jun 18, 2024
1 parent c4757ee commit 79f914d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion resources/js/utils/useTimeEntries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const useTimeEntriesStore = defineStore('timeEntries', () => {
async function updateTimeEntry(timeEntry: TimeEntry) {
const organizationId = getCurrentOrganizationId();
if (organizationId) {
await handleApiRequestNotifications(
const response = await handleApiRequestNotifications(
() =>
api.updateTimeEntry(timeEntry, {
params: {
Expand All @@ -89,6 +89,9 @@ export const useTimeEntriesStore = defineStore('timeEntries', () => {
'Time entry updated successfully',
'Failed to update time entry'
);
timeEntries.value = timeEntries.value.map((entry) =>
entry.id === timeEntry.id ? response.data : entry
);
}
}

Expand Down

0 comments on commit 79f914d

Please sign in to comment.