Skip to content

Commit b0d122e

Browse files
fix(store/filters): remove premature emit from onFilterUpdateChips
onFilterUpdateChips was emitting libresign:filters:update before filter_status was persisted, causing getAllFiles to run with stale state. The subsequent call from onFilterUpdateChipsAndSave (which actually persists the new value) was then skipped because loading=true. Only onFilterUpdateChipsAndSave should trigger a re-fetch, since it is the action that actually updates filter_status/filter_modified. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent d7dfaef commit b0d122e

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/store/filters.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ export const useFiltersStore = defineStore('filter', {
4444
async onFilterUpdateChips(event) {
4545
this.chips = { ...this.chips, [event.id]: [...event.detail] }
4646

47-
emit('libresign:filters:update')
4847
logger.debug('File list filter chips updated', { chips: event.detail })
4948

5049
},

src/tests/store/filters.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ describe('filters store - filter business rules', () => {
198198
})
199199
})
200200

201-
describe('business rule: chips update should emit filter event', () => {
202-
it('onFilterUpdateChips should emit libresign:filters:update event', async () => {
201+
describe('business rule: chips update should only update UI chips state', () => {
202+
it('onFilterUpdateChips should NOT emit libresign:filters:update event', async () => {
203203
const store = useFiltersStore()
204204
const event = {
205205
id: 'status',
@@ -208,7 +208,7 @@ describe('filters store - filter business rules', () => {
208208

209209
await store.onFilterUpdateChips(event)
210210

211-
expect(emit).toHaveBeenCalledWith('libresign:filters:update')
211+
expect(emit).not.toHaveBeenCalled()
212212
})
213213

214214
it('onFilterUpdateChips should update chips for specific filter', async () => {

0 commit comments

Comments
 (0)