From 84da11a475fac3b164328c9c6375c4491382ef71 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 20 Apr 2023 15:23:57 +0100 Subject: [PATCH] Remove commented out usages of websocket emissions for grid --- packages/server/src/api/controllers/row/index.ts | 11 ----------- packages/server/src/websockets/websocket.ts | 5 ++++- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/server/src/api/controllers/row/index.ts b/packages/server/src/api/controllers/row/index.ts index c9f79dcb49..349c4e72e7 100644 --- a/packages/server/src/api/controllers/row/index.ts +++ b/packages/server/src/api/controllers/row/index.ts @@ -2,7 +2,6 @@ import { quotas } from "@budibase/pro" import * as internal from "./internal" import * as external from "./external" import { isExternalTable } from "../../../integrations/utils" -import { gridSocket } from "../../../websockets" import { Ctx } from "@budibase/types" import * as utils from "./utils" @@ -48,9 +47,6 @@ export async function patch(ctx: any): Promise { ctx.eventEmitter.emitRow(`row:update`, appId, row, table) ctx.message = `${table.name} updated successfully.` ctx.body = row - - // Notify websocket change - gridSocket?.emit("row-update", { id: row._id }) } catch (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.message = `${table.name} saved successfully` ctx.body = row - - // Notify websocket change - gridSocket?.emit("row-update", { id: row._id }) } export async function fetchView(ctx: any) { const tableId = getTableId(ctx) @@ -114,8 +107,6 @@ export async function destroy(ctx: any) { response = rows for (let row of rows) { ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row) - // Notify websocket change - gridSocket?.emit("row-update", { id: row._id }) } } else { let resp = await quotas.addQuery(() => pickApi(tableId).destroy(ctx), { @@ -125,8 +116,6 @@ export async function destroy(ctx: any) { response = resp.response row = resp.row ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:delete`, appId, row) - // Notify websocket change - gridSocket?.emit("row-update", { id: row._id }) } ctx.status = 200 // for automations include the row that was deleted diff --git a/packages/server/src/websockets/websocket.ts b/packages/server/src/websockets/websocket.ts index e88c1f9744..1b34168f14 100644 --- a/packages/server/src/websockets/websocket.ts +++ b/packages/server/src/websockets/websocket.ts @@ -48,7 +48,10 @@ export default class Socket { // Needed for koa-useragent middleware headers: 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