Skip to content

Commit a5d44e4

Browse files
authored
fix: continue unassigning other declarations (#9660)
* fix: continue unassigning other declarations One failing unassign was blocking all the other unassign actions from continuing * docs: update CHANGELOG * chore: descriptive variable name
1 parent 966c288 commit a5d44e4

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Fix practitioner role history entries from being created with every view and download [#9462](https://github.com/opencrvs/opencrvs-core/issues/9462)
1616
- Fix a child's NID form field cannot be added eithe rmanually or via ESignet. A father section cannot be placed before a mother section if you wish to use a radio button to control mapping addresses from one individual to aother to make data entry easier [#9582](https://github.com/opencrvs/opencrvs-core/issues/9582)
1717
- Fix the role of the certifier unable to get resolved for new users which in turn caused the download of the declaration to fail [#9643](https://github.com/opencrvs/opencrvs-core/issues/9643)
18+
- Fix one failing unassign blocking all other unassign actions from continuing [#9651](https://github.com/opencrvs/opencrvs-core/issues/9651)
1819

1920
## [1.7.1](https://github.com/opencrvs/opencrvs-core/compare/v1.7.0...v1.7.1)
2021

packages/client/src/declarations/index.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,12 @@ export const declarationsReducer: LoopReducer<IDeclarationsState, Action> = (
18861886
)
18871887
case UNASSIGN_DECLARATION_FAILED: {
18881888
const error = action.payload.error
1889-
const declarationNextToUnassign = state.declarations.find(
1889+
/*
1890+
* The next declaration that's ready to be unassigned.
1891+
* We don't want to hold up the unassign queue because
1892+
* of one failed unassign action
1893+
*/
1894+
const nextInUnassignQueue = state.declarations.find(
18901895
(declaration) =>
18911896
declaration.downloadStatus === DOWNLOAD_STATUS.READY_TO_UNASSIGN
18921897
)
@@ -1906,10 +1911,10 @@ export const declarationsReducer: LoopReducer<IDeclarationsState, Action> = (
19061911
)
19071912
),
19081913
Cmd.action(updateRegistrarWorkqueue()),
1909-
declarationNextToUnassign
1914+
nextInUnassignQueue
19101915
? Cmd.action(
19111916
executeUnassignDeclaration(
1912-
declarationNextToUnassign.id,
1917+
nextInUnassignQueue.id,
19131918
action.payload.client,
19141919
action.payload.refetchQueries
19151920
)
@@ -1920,6 +1925,18 @@ export const declarationsReducer: LoopReducer<IDeclarationsState, Action> = (
19201925
)
19211926
)
19221927
}
1928+
if (nextInUnassignQueue) {
1929+
return loop(
1930+
state,
1931+
Cmd.action(
1932+
executeUnassignDeclaration(
1933+
nextInUnassignQueue.id,
1934+
action.payload.client,
1935+
action.payload.refetchQueries
1936+
)
1937+
)
1938+
)
1939+
}
19231940
return state
19241941
}
19251942

0 commit comments

Comments
 (0)