Ensue table schema change made via grids are properly synced with backend stores, given absence of websocket events for own events
This commit is contained in:
parent
2db3012ae0
commit
0582dd40b2
|
@ -37,6 +37,7 @@
|
|||
allowDeleteRows={!isUsersTable}
|
||||
schemaOverrides={isUsersTable ? userSchemaOverrides : null}
|
||||
showAvatars={false}
|
||||
on:updatetable={e => tables.replaceTable(id, e.detail)}
|
||||
>
|
||||
<svelte:fragment slot="controls">
|
||||
{#if isInternal}
|
||||
|
|
|
@ -46,7 +46,7 @@ export const createStores = () => {
|
|||
}
|
||||
|
||||
export const deriveStores = context => {
|
||||
const { table, columns, stickyColumn, API } = context
|
||||
const { table, columns, stickyColumn, API, dispatch } = context
|
||||
|
||||
// Updates the tables primary display column
|
||||
const changePrimaryDisplay = async column => {
|
||||
|
@ -90,6 +90,10 @@ export const deriveStores = context => {
|
|||
// Update local state
|
||||
table.set(newTable)
|
||||
|
||||
// Broadcast change to external state can be updated, as this change
|
||||
// will not be received by the builder websocket because we caused it ourselves
|
||||
dispatch("updatetable", newTable)
|
||||
|
||||
// Update server
|
||||
await API.saveTable(newTable)
|
||||
}
|
||||
|
|
|
@ -52,8 +52,6 @@ export const createWebsocket = (path, options = DefaultOptions) => {
|
|||
socket.on(event, data => {
|
||||
if (data?.apiSessionId !== APISessionID) {
|
||||
callback(data)
|
||||
} else {
|
||||
console.log("ignore", event, data)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue