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.sourceId = tableId
|
||||||
|
ctx.params.viewId = viewId
|
||||||
|
|
||||||
return next()
|
return next()
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,8 +80,8 @@ export default class GridSocket extends BaseSocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
emitRowUpdate(ctx: any, row: Row) {
|
emitRowUpdate(ctx: any, row: Row) {
|
||||||
const tableId = getTableId(ctx)
|
const resourceId = ctx.params?.viewId || getTableId(ctx)
|
||||||
const room = `${ctx.appId}-${tableId}`
|
const room = `${ctx.appId}-${resourceId}`
|
||||||
this.emitToRoom(ctx, room, GridSocketEvent.RowChange, {
|
this.emitToRoom(ctx, room, GridSocketEvent.RowChange, {
|
||||||
id: row._id,
|
id: row._id,
|
||||||
row,
|
row,
|
||||||
|
@ -89,8 +89,8 @@ export default class GridSocket extends BaseSocket {
|
||||||
}
|
}
|
||||||
|
|
||||||
emitRowDeletion(ctx: any, id: string) {
|
emitRowDeletion(ctx: any, id: string) {
|
||||||
const tableId = getTableId(ctx)
|
const resourceId = ctx.params?.viewId || getTableId(ctx)
|
||||||
const room = `${ctx.appId}-${tableId}`
|
const room = `${ctx.appId}-${resourceId}`
|
||||||
this.emitToRoom(ctx, room, GridSocketEvent.RowChange, { id, row: null })
|
this.emitToRoom(ctx, room, GridSocketEvent.RowChange, { id, row: null })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue