Browse Source

Improve validation around loading options for relationship field

master
Andrew Kingston 6 years ago
parent
commit
abd99f859a
  1. 8
      packages/standard-components/src/forms/RelationshipField.svelte

8
packages/standard-components/src/forms/RelationshipField.svelte

@ -25,13 +25,17 @@
const fetchTable = async id => { const fetchTable = async id => {
if (id != null) { if (id != null) {
tableDefinition = await API.fetchTableDefinition(id) const result = await API.fetchTableDefinition(id)
if (!result.error) {
tableDefinition = result
}
} }
} }
const fetchRows = async id => { const fetchRows = async id => {
if (id != null) { if (id != null) {
options = await API.fetchTableData(id) const rows = await API.fetchTableData(id)
options = rows && !rows.error ? rows : []
} }
} }

Loading…
Cancel
Save