1
0
Fork 0
mirror of synced 2024-10-02 10:08:09 +13:00

Update websocket user metadata structures

This commit is contained in:
Andrew Kingston 2023-07-03 11:23:08 +01:00
parent d80cca9a11
commit 4725faf8b5
3 changed files with 17 additions and 2 deletions

View file

@ -30,8 +30,9 @@ export const deriveStores = context => {
([$users, $focusedCellId]) => {
let map = {}
$users.forEach(user => {
if (user.focusedCellId && user.focusedCellId !== $focusedCellId) {
map[user.focusedCellId] = user
const cellId = user.gridMetadata?.focusedCellId
if (cellId && cellId !== $focusedCellId) {
map[cellId] = user
}
})
return map

View file

@ -78,6 +78,13 @@ export default class BuilderSocket extends BaseSocket {
}
}
async updateUser(socket: Socket, patch: Object) {
await super.updateUser(socket, {
...socket.data.builderMetadata,
...patch,
})
}
emitTableUpdate(ctx: any, table: Table) {
this.emitToRoom(ctx, ctx.appId, BuilderSocketEvent.TableChange, {
id: table._id,

View file

@ -69,6 +69,13 @@ export default class GridSocket extends BaseSocket {
})
}
async updateUser(socket: Socket, patch: Object) {
await super.updateUser(socket, {
...socket.data.gridMetadata,
...patch,
})
}
emitRowUpdate(ctx: any, row: Row) {
const tableId = getTableId(ctx)
const room = `${ctx.appId}-${tableId}`