@globalbrain/sefirot 4.43.3 → 4.43.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -34,7 +34,21 @@ const fieldFactory = useFieldFactory()
|
|
|
34
34
|
|
|
35
35
|
const records = computed(() => props.result?.data ?? [])
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
// Resolve the list of columns to render. We intersect the caller's
|
|
38
|
+
// requested `select` with what the latest response actually fetched so
|
|
39
|
+
// that toggling a column on through "Manage table view" doesn't surface
|
|
40
|
+
// a new column synchronously against still-stale records. Without this,
|
|
41
|
+
// fields like `SelectField` blow up trying to render `undefined` for
|
|
42
|
+
// the brand-new column before the refresh response lands.
|
|
43
|
+
const columnKeys = computed(() => {
|
|
44
|
+
const requested = props.select ?? props.result?.query.select ?? []
|
|
45
|
+
const fetched = props.result?.query.select
|
|
46
|
+
if (!fetched) {
|
|
47
|
+
return requested
|
|
48
|
+
}
|
|
49
|
+
const fetchedSet = new Set(fetched)
|
|
50
|
+
return requested.filter((k) => fetchedSet.has(k))
|
|
51
|
+
})
|
|
38
52
|
|
|
39
53
|
const orders = computed(() => [
|
|
40
54
|
...columnKeys.value,
|
|
@@ -48,6 +62,14 @@ const columns = computedAsync(async () => {
|
|
|
48
62
|
return {}
|
|
49
63
|
}
|
|
50
64
|
|
|
65
|
+
// Snapshot the column keys at the start of the run. `columnKeys` is a
|
|
66
|
+
// computed off reactive props; if it changes mid-await (e.g. the user
|
|
67
|
+
// toggles a column off in "Manage table view"), subsequent reads
|
|
68
|
+
// through the live ref would jump to the new, shorter array and
|
|
69
|
+
// produce `undefined` for indices past the new length — crashing
|
|
70
|
+
// `Object.assign(_fieldData, ...)` below.
|
|
71
|
+
const keys = [...columnKeys.value]
|
|
72
|
+
|
|
51
73
|
// Prepare base columns that has `__last_empty__` to fill the end space.
|
|
52
74
|
const columns: TableColumns<any, any, any> = {
|
|
53
75
|
__last_empty__: {
|
|
@@ -56,11 +78,13 @@ const columns = computedAsync(async () => {
|
|
|
56
78
|
}
|
|
57
79
|
|
|
58
80
|
// Build the list of columns based on the resolved column key list.
|
|
59
|
-
for (const
|
|
60
|
-
const key = columnKeys.value[i]
|
|
61
|
-
|
|
81
|
+
for (const key of keys) {
|
|
62
82
|
const _fieldData = cloneDeep(r.fields[key])
|
|
63
83
|
|
|
84
|
+
if (!_fieldData) {
|
|
85
|
+
continue
|
|
86
|
+
}
|
|
87
|
+
|
|
64
88
|
const overriddenFieldData = Object.assign(
|
|
65
89
|
_fieldData,
|
|
66
90
|
props.overrides?.[key] ?? {}
|
package/lib/support/Http.ts
CHANGED
|
@@ -42,22 +42,11 @@ export function objectToFormData(
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export function getHttpStatusCode(error: any): number | undefined {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
error?.details?.status,
|
|
53
|
-
error?.details?.statusCode,
|
|
54
|
-
error?.cause?.status,
|
|
55
|
-
error?.cause?.statusCode,
|
|
56
|
-
error?.cause?.response?.status,
|
|
57
|
-
error?.cause?.response?.statusCode,
|
|
58
|
-
error?.code,
|
|
59
|
-
error?.cause?.code
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
return candidates.map(Number).find((n) => Number.isInteger(n) && n >= 100 && n <= 599)
|
|
45
|
+
const sources = [error, error?.cause, error?.details, error?.error]
|
|
46
|
+
.filter((s) => s && typeof s === 'object')
|
|
47
|
+
|
|
48
|
+
return sources
|
|
49
|
+
.flatMap((s) => [s.status, s.statusCode, s.response?.status, s.response?.statusCode, s.code])
|
|
50
|
+
.map(Number)
|
|
51
|
+
.find((n) => Number.isInteger(n) && n >= 100 && n <= 599)
|
|
63
52
|
}
|