Persist source view ID in ctx when using a view ID in the rows API and support collab in views
This commit is contained in:
parent
abc072cbbe
commit
e7c4ebea39
|
@ -27,6 +27,7 @@ export default async (ctx: Ctx<Row>, next: Next) => {
|
|||
}
|
||||
|
||||
ctx.params.sourceId = tableId
|
||||
ctx.params.viewId = viewId
|
||||
|
||||
return next()
|
||||
}
|
||||
|
|
|
@ -80,8 +80,8 @@ export default class GridSocket extends BaseSocket {
|
|||
}
|
||||
|
||||
emitRowUpdate(ctx: any, row: Row) {
|
||||
const tableId = getTableId(ctx)
|
||||
const room = `${ctx.appId}-${tableId}`
|
||||
const resourceId = ctx.params?.viewId || getTableId(ctx)
|
||||
const room = `${ctx.appId}-${resourceId}`
|
||||
this.emitToRoom(ctx, room, GridSocketEvent.RowChange, {
|
||||
id: row._id,
|
||||
row,
|
||||
|
@ -89,8 +89,8 @@ export default class GridSocket extends BaseSocket {
|
|||
}
|
||||
|
||||
emitRowDeletion(ctx: any, id: string) {
|
||||
const tableId = getTableId(ctx)
|
||||
const room = `${ctx.appId}-${tableId}`
|
||||
const resourceId = ctx.params?.viewId || getTableId(ctx)
|
||||
const room = `${ctx.appId}-${resourceId}`
|
||||
this.emitToRoom(ctx, room, GridSocketEvent.RowChange, { id, row: null })
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue