diff --git a/src/pages/chat/chat.ts b/src/pages/chat/chat.ts index 819f2e5..9344dc6 100755 --- a/src/pages/chat/chat.ts +++ b/src/pages/chat/chat.ts @@ -641,6 +641,7 @@ class ChatElement extends HTMLElement { const service = await Services.getInstance(); // Get the `commited_in` value of the last state and remove it from the array const currentCommitedIn = process.states.pop()?.commited_in; + console.log('Current CommitedIn (roles):' currentCommitedIn); if (currentCommitedIn === undefined) { return null; // No states available @@ -650,6 +651,7 @@ class ChatElement extends HTMLElement { let lastDifferentState = process.states.findLast( state => state.commited_in !== currentCommitedIn ); + if (!lastDifferentState) { // It means that we only have one state that is not commited yet, that can happen with process we just created @@ -657,6 +659,12 @@ class ChatElement extends HTMLElement { lastDifferentState = process.states.pop(); } + if (!lastDifferentState.pcd_commitment) { + return null; + } + + console.log('lastDifferentState (roles):'lastDifferentState); + // Take the roles out of the state const roles = lastDifferentState!.pcd_commitment['roles']; if (roles) {