diff --git a/packages/frontend-core/src/components/grid/lib/websocket.js b/packages/frontend-core/src/components/grid/lib/websocket.js index a62910c2fa..3f1c473ea0 100644 --- a/packages/frontend-core/src/components/grid/lib/websocket.js +++ b/packages/frontend-core/src/components/grid/lib/websocket.js @@ -33,9 +33,12 @@ export const createGridWebsocket = context => { }) // Row events - socket.on("row-change", data => { + socket.on("row-change", async data => { if (data.id) { rows.actions.replaceRow(data.id, data.row) + } else if (data.row.id) { + // Handle users table edge case + await rows.actions.refreshRow(data.row.id) } }) diff --git a/packages/frontend-core/src/components/grid/stores/rows.js b/packages/frontend-core/src/components/grid/stores/rows.js index f6c709b675..4b93e1d58f 100644 --- a/packages/frontend-core/src/components/grid/stores/rows.js +++ b/packages/frontend-core/src/components/grid/stores/rows.js @@ -345,10 +345,15 @@ export const deriveStores = context => { const saved = await API.saveRow({ ...row, ...get(rowChangeCache)[rowId] }) // Update state after a successful change - rows.update(state => { - state[index] = saved - return state.slice() - }) + if (saved?._id) { + rows.update(state => { + state[index] = saved + return state.slice() + }) + } else if (saved?.id) { + // Handle users table edge case + await refreshRow(saved.id) + } rowChangeCache.update(state => { delete state[rowId] return state