@box/metadata-editor 0.67.1 → 0.67.3
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.
@@ -1,9 +1,10 @@
|
|
1
|
-
import { useReducer as
|
1
|
+
import { useReducer as O } from "react";
|
2
2
|
import { RequestStates as u } from "./request.js";
|
3
|
+
import { isAbortError as I } from "./utils/is-abort-error.js";
|
3
4
|
var s = /* @__PURE__ */ function(r) {
|
4
5
|
return r.LOAD_MORE = "LOAD_MORE", r.RELOAD = "RELOAD", r.SEARCH = "SEARCH", r.SET_ERROR = "SET_ERROR", r.SET_LOADING = "SET_LOADING", r;
|
5
6
|
}(s || {});
|
6
|
-
function
|
7
|
+
function a(r, e) {
|
7
8
|
switch (e.type) {
|
8
9
|
case s.LOAD_MORE:
|
9
10
|
return {
|
@@ -58,52 +59,52 @@ function E(r, e) {
|
|
58
59
|
function S(r, e) {
|
59
60
|
return e.requestInitiator === s.LOAD_MORE && e.requestState === u.IN_PROGRESS && r.type === s.LOAD_MORE;
|
60
61
|
}
|
61
|
-
function
|
62
|
+
function m(r, e) {
|
62
63
|
return E(r, e) || S(r, e);
|
63
64
|
}
|
64
|
-
function
|
65
|
+
function p(r, e) {
|
65
66
|
var t;
|
66
67
|
E(r, e) && e.abortController.abort(), S(r, e) && ((t = r.abortController) == null || t.abort());
|
67
68
|
}
|
68
|
-
function
|
69
|
+
function h(r, e) {
|
69
70
|
return S(r, e);
|
70
71
|
}
|
71
72
|
async function R(r, e, t, n) {
|
72
|
-
const
|
73
|
-
if (
|
73
|
+
const o = new AbortController();
|
74
|
+
if (m(r, t) && p(r, t), !h(r, t)) {
|
74
75
|
n({
|
75
76
|
type: s.SET_LOADING,
|
76
77
|
requestInitiator: r.type,
|
77
|
-
abortController:
|
78
|
+
abortController: o
|
78
79
|
});
|
79
80
|
try {
|
80
|
-
const
|
81
|
+
const l = await e({
|
81
82
|
items: t.items.slice(),
|
82
|
-
signal:
|
83
|
+
signal: o.signal,
|
83
84
|
marker: r.type === s.LOAD_MORE ? t.marker : null,
|
84
85
|
searchInput: r.searchInput ?? t.searchInput
|
85
|
-
}),
|
86
|
+
}), i = l.searchInput ?? r.searchInput ?? t.searchInput;
|
86
87
|
n({
|
87
88
|
type: r.type,
|
88
|
-
...
|
89
|
-
searchInput:
|
90
|
-
abortController:
|
89
|
+
...l,
|
90
|
+
searchInput: i,
|
91
|
+
abortController: o
|
91
92
|
});
|
92
|
-
} catch (
|
93
|
-
if ((
|
93
|
+
} catch (l) {
|
94
|
+
if (I(l))
|
94
95
|
return;
|
95
96
|
n({
|
96
97
|
type: s.SET_ERROR,
|
97
|
-
error:
|
98
|
-
abortController:
|
98
|
+
error: l,
|
99
|
+
abortController: o
|
99
100
|
});
|
100
101
|
}
|
101
102
|
}
|
102
103
|
}
|
103
|
-
function
|
104
|
+
function _(r) {
|
104
105
|
const {
|
105
106
|
load: e
|
106
|
-
} = r, [t, n] =
|
107
|
+
} = r, [t, n] = O(a, {
|
107
108
|
error: null,
|
108
109
|
items: [],
|
109
110
|
requestInitiator: null,
|
@@ -125,12 +126,12 @@ function C(r) {
|
|
125
126
|
}, e, t, n),
|
126
127
|
requestInitiator: t.requestInitiator,
|
127
128
|
searchInput: t.searchInput,
|
128
|
-
search: (
|
129
|
+
search: (o) => R({
|
129
130
|
type: s.SEARCH,
|
130
|
-
searchInput:
|
131
|
+
searchInput: o
|
131
132
|
}, e, t, n)
|
132
133
|
};
|
133
134
|
}
|
134
135
|
export {
|
135
|
-
|
136
|
+
_ as useAsyncList
|
136
137
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@box/metadata-editor",
|
3
|
-
"version": "0.67.
|
3
|
+
"version": "0.67.3",
|
4
4
|
"peerDependencies": {
|
5
5
|
"@ariakit/react": "0.4.5",
|
6
6
|
"@box/blueprint-web": "^7.30.3",
|
@@ -53,5 +53,5 @@
|
|
53
53
|
"**/*.css"
|
54
54
|
],
|
55
55
|
"license": "SEE LICENSE IN LICENSE",
|
56
|
-
"gitHead": "
|
56
|
+
"gitHead": "254f87a48e69399b6138d000899e0fd2217f179a"
|
57
57
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function isAbortError(error: unknown): boolean;
|