renaming bug

This commit is contained in:
Martin McKeaveney 2020-08-20 17:04:54 +01:00
parent 841ee44835
commit dfb5eb9bb6
2 changed files with 10 additions and 4 deletions

View File

@ -93,7 +93,13 @@ export const getBackendUiStore = () => {
saveField: ({ originalName, field }) => {
store.update(state => {
// delete the original if renaming
delete state.draftModel.schema[originalName]
if (originalName) {
delete state.draftModel.schema[originalName]
state.draftModel._rename = {
old: originalName,
updated: field.name,
}
}
state.draftModel.schema[field.name] = cloneDeep(field)

View File

@ -45,9 +45,9 @@
$: sort = $backendUiStore.sort
$: sorted = sort ? fsort(data)[sort.direction](sort.column) : data
$: headers = Object.keys($backendUiStore.selectedModel.schema).filter(
id => !INTERNAL_HEADERS.includes(id)
)
$: headers = Object.keys($backendUiStore.selectedModel.schema)
.sort()
.filter(id => !INTERNAL_HEADERS.includes(id))
$: schema = $backendUiStore.selectedModel.schema
</script>