Remove commented out usages of websocket emissions for grid

This commit is contained in:
Andrew Kingston 2023-04-20 15:23:57 +01:00
parent fe5ab61941
commit 84da11a475
2 changed files with 4 additions and 12 deletions

View File

@ -2,7 +2,6 @@ import { quotas } from "@budibase/pro"
import * as internal from "./internal" import * as internal from "./internal"
import * as external from "./external" import * as external from "./external"
import { isExternalTable } from "../../../integrations/utils" import { isExternalTable } from "../../../integrations/utils"
import { gridSocket } from "../../../websockets"
import { Ctx } from "@budibase/types" import { Ctx } from "@budibase/types"
import * as utils from "./utils" import * as utils from "./utils"
@ -48,9 +47,6 @@ export async function patch(ctx: any): Promise<any> {
ctx.eventEmitter.emitRow(`row:update`, appId, row, table) ctx.eventEmitter.emitRow(`row:update`, appId, row, table)
ctx.message = `${table.name} updated successfully.` ctx.message = `${table.name} updated successfully.`
ctx.body = row ctx.body = row
// Notify websocket change
gridSocket?.emit("row-update", { id: row._id })
} catch (err) { } catch (err) {
ctx.throw(400, err) ctx.throw(400, err)
} }
@ -73,9 +69,6 @@ export const save = async (ctx: any) => {
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:save`, appId, row, table) ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:save`, appId, row, table)
ctx.message = `${table.name} saved successfully` ctx.message = `${table.name} saved successfully`
ctx.body = row ctx.body = row
// Notify websocket change
gridSocket?.emit("row-update", { id: row._id })
} }
export async function fetchView(ctx: any) { export async function fetchView(ctx: any) {
const tableId = getTableId(ctx) const tableId = getTableId(ctx)
@ -114,8 +107,6 @@ export async function destroy(ctx: any) {
response = rows response = rows
for (let row of rows) { for (let row of rows) {
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row) ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row)
// Notify websocket change
gridSocket?.emit("row-update", { id: row._id })
} }
} else { } else {
let resp = await quotas.addQuery(() => pickApi(tableId).destroy(ctx), { let resp = await quotas.addQuery(() => pickApi(tableId).destroy(ctx), {
@ -125,8 +116,6 @@ export async function destroy(ctx: any) {
response = resp.response response = resp.response
row = resp.row row = resp.row
ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row) ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row)
// Notify websocket change
gridSocket?.emit("row-update", { id: row._id })
} }
ctx.status = 200 ctx.status = 200
// for automations include the row that was deleted // for automations include the row that was deleted

View File

@ -48,7 +48,10 @@ export default class Socket {
// Needed for koa-useragent middleware // Needed for koa-useragent middleware
headers: socket.request.headers, headers: socket.request.headers,
header: socket.request.headers, header: socket.request.headers,
path: "/socket/grid",
// We don't really care about the path since it will never contain
// an app ID
path: "/socket",
} }
// Run all koa middlewares // Run all koa middlewares