Fix websocket error

This commit is contained in:
Andrew Kingston 2023-07-31 11:21:11 +01:00
parent 0c72d08763
commit fdfedfdd92
3 changed files with 8 additions and 6 deletions

View File

@ -104,8 +104,6 @@ export const createActions = context => {
instanceLoaded.set(false)
loading.set(true)
console.log($datasource)
// Abandon if we don't have a valid datasource
if (!$datasource?.tableId) {
return
@ -270,7 +268,6 @@ export const createActions = context => {
} else {
return
}
console.log(newRow)
newRow = await API.saveRow(newRow, SuppressErrors)
// Update state

View File

@ -21,8 +21,13 @@ export default class GridSocket extends BaseSocket {
async onConnect(socket: Socket) {
// Initial identification of connected spreadsheet
socket.on(
GridSocketEvent.SelectTable,
async ({ tableId, appId }, callback) => {
GridSocketEvent.SelectDatasource,
async ({ datasource, appId }, callback) => {
if (datasource?.type !== "table") {
return
}
const tableId = datasource.tableId
// Ignore if no table or app specified
if (!tableId || !appId) {
socket.disconnect(true)

View File

@ -77,7 +77,7 @@ export enum SocketEvent {
export enum GridSocketEvent {
RowChange = "RowChange",
TableChange = "TableChange",
SelectTable = "SelectTable",
SelectDatasource = "SelectDatasource",
SelectCell = "SelectCell",
}