Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/long-islands-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@forgerock/davinci-client': patch
---

handle formData lookup with more saftey in case it is not in response
4 changes: 3 additions & 1 deletion packages/davinci-client/src/lib/node.reducer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ describe('The node collector reducer', () => {
},
],
formData: {
username: 'This is the default data',
value: {
username: 'This is the default data',
},
},
},
};
Expand Down
7 changes: 5 additions & 2 deletions packages/davinci-client/src/lib/node.reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import {
*/
export const nextCollectorValues = createAction<{
fields: DaVinciField[];
formData: Record<string, unknown>;
formData: { value: Record<string, unknown> };
}>('node/next');
export const updateCollectorValues = createAction<{
id: string;
Expand Down Expand Up @@ -97,7 +97,10 @@ export const nodeCollectorReducer = createReducer(initialCollectorValues, (build
}

// *Some* collectors may have default or existing data to display
const data = action.payload.formData[field.key];
const data =
action.payload.formData &&
action.payload.formData.value &&
action.payload.formData.value[field.key];

// Match specific collectors
switch (field.type) {
Expand Down
Loading