Fixing some issues found with deleting tables and relationships not getting cleaned up fully + builder not updating - also making sure builder store initial state of screens is accurate.
This commit is contained in:
parent
fff78a0072
commit
c5dc50e8bf
|
@ -129,7 +129,10 @@ const setPackage = (store, initial) => async pkg => {
|
||||||
initial.appId = pkg.application._id
|
initial.appId = pkg.application._id
|
||||||
initial.pages = pkg.pages
|
initial.pages = pkg.pages
|
||||||
initial.hasAppPackage = true
|
initial.hasAppPackage = true
|
||||||
initial.screens = values(pkg.screens)
|
initial.screens = [
|
||||||
|
...Object.values(main_screens),
|
||||||
|
...Object.values(unauth_screens),
|
||||||
|
]
|
||||||
initial.builtins = [getBuiltin("##builtin/screenslot")]
|
initial.builtins = [getBuiltin("##builtin/screenslot")]
|
||||||
initial.appInstances = pkg.application.instances
|
initial.appInstances = pkg.application.instances
|
||||||
initial.appId = pkg.application._id
|
initial.appId = pkg.application._id
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
async function deleteTable() {
|
async function deleteTable() {
|
||||||
await backendUiStore.actions.tables.delete(table)
|
await backendUiStore.actions.tables.delete(table)
|
||||||
store.deleteScreens(templateScreens)
|
store.deleteScreens(templateScreens)
|
||||||
|
await backendUiStore.actions.tables.fetch()
|
||||||
notifier.success("Table deleted")
|
notifier.success("Table deleted")
|
||||||
hideEditor()
|
hideEditor()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const CouchDB = require("../index")
|
const CouchDB = require("../index")
|
||||||
const { IncludeDocs, getLinkDocuments } = require("./linkUtils")
|
const { IncludeDocs, getLinkDocuments } = require("./linkUtils")
|
||||||
const { generateLinkID } = require("../utils")
|
const { generateLinkID } = require("../utils")
|
||||||
|
const Sentry = require("@sentry/node")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new link document structure which can be put to the database. It is important to
|
* Creates a new link document structure which can be put to the database. It is important to
|
||||||
|
@ -289,10 +290,14 @@ class LinkController {
|
||||||
const schema = table.schema
|
const schema = table.schema
|
||||||
for (let fieldName of Object.keys(schema)) {
|
for (let fieldName of Object.keys(schema)) {
|
||||||
const field = schema[fieldName]
|
const field = schema[fieldName]
|
||||||
if (field.type === "link") {
|
try {
|
||||||
const linkedTable = await this._db.get(field.tableId)
|
if (field.type === "link") {
|
||||||
delete linkedTable.schema[table.name]
|
const linkedTable = await this._db.get(field.tableId)
|
||||||
await this._db.put(linkedTable)
|
delete linkedTable.schema[field.fieldName]
|
||||||
|
await this._db.put(linkedTable)
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
Sentry.captureException(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// need to get the full link docs to delete them
|
// need to get the full link docs to delete them
|
||||||
|
|
Loading…
Reference in New Issue