@parallelworks/ui 0.21.1 → 0.21.2
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.
|
@@ -187,6 +187,40 @@ function FileExplorer({ storages, onRefresh, refreshKey, onOpenFile, showUserHie
|
|
|
187
187
|
const [accessDrawerOpen, setAccessDrawerOpen] = useState(false);
|
|
188
188
|
const [connectionIssuesMessage, updateConnectionIssuesMessage] = useState(/* @__PURE__ */ new Map());
|
|
189
189
|
const [hasCorsIssue, setHasCorsIssue] = useState(/* @__PURE__ */ new Map());
|
|
190
|
+
const storageRoots = useMemo(() => {
|
|
191
|
+
const roots = /* @__PURE__ */ new Map();
|
|
192
|
+
for (const node of rootNodes) {
|
|
193
|
+
const candidates = node.root ? [node] : parentToChildrenMap[node.path] ?? [];
|
|
194
|
+
for (const root of candidates) if (root.root && root.storageId) roots.set(root.storageId, root.path);
|
|
195
|
+
}
|
|
196
|
+
return roots;
|
|
197
|
+
}, [rootNodes, parentToChildrenMap]);
|
|
198
|
+
const seenStorageRootsRef = useRef(storageRoots);
|
|
199
|
+
const forgetStorages = useEffectEvent((removed) => {
|
|
200
|
+
const isUnder = (path) => removed.some(([, root]) => path !== root && path.startsWith(root));
|
|
201
|
+
const isWithin = (path) => removed.some(([, root]) => path.startsWith(root));
|
|
202
|
+
for (const path of [...fetchesInFlightRef.current.keys()]) if (isWithin(path)) fetchesInFlightRef.current.delete(path);
|
|
203
|
+
setListings((prev) => removed.reduce((next, [, root]) => clearListingsUnder(next, root), prev));
|
|
204
|
+
setLoadingPaths((prev) => new Set([...prev].filter((path) => !isWithin(path))));
|
|
205
|
+
setExpandedPaths((prev) => new Set([...prev].filter((path) => !isUnder(path))));
|
|
206
|
+
const withoutRemoved = (prev) => {
|
|
207
|
+
const next = new Map(prev);
|
|
208
|
+
for (const [id] of removed) next.delete(id);
|
|
209
|
+
return next;
|
|
210
|
+
};
|
|
211
|
+
updateConnectionIssuesMessage(withoutRemoved);
|
|
212
|
+
setHasCorsIssue(withoutRemoved);
|
|
213
|
+
const selectedRoot = removed.find(([, root]) => normalizedSelectedPath.startsWith(root))?.[1];
|
|
214
|
+
if (selectedRoot) {
|
|
215
|
+
const parent = getParentPath(selectedRoot);
|
|
216
|
+
setSelectedPath(treeMap[parent] ? parent : "");
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
useEffect(() => {
|
|
220
|
+
const removed = [...seenStorageRootsRef.current].filter(([id]) => !storageRoots.has(id));
|
|
221
|
+
seenStorageRootsRef.current = storageRoots;
|
|
222
|
+
if (removed.length > 0) forgetStorages(removed);
|
|
223
|
+
}, [storageRoots]);
|
|
190
224
|
const [uploadModalOpen, setUploadModalOpen] = useState(false);
|
|
191
225
|
const [createFolderTarget, setCreateFolderTarget] = useState(null);
|
|
192
226
|
const [pendingUpload, setPendingUpload] = useState(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parallelworks/ui",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.2",
|
|
4
4
|
"description": "React UI components: a theme contract, icons, primitives, lists, forms, a job graph, a code editor, a log viewer, a file explorer and an AI chat, each on its own subpath",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"anser": "^2.3.5",
|
|
91
91
|
"classnames": "^2.5.1",
|
|
92
92
|
"fast-deep-equal": "^3.1.3",
|
|
93
|
-
"framer-motion": "^
|
|
93
|
+
"framer-motion": "^14.0.0",
|
|
94
94
|
"luxon": "^3.7.2",
|
|
95
95
|
"re-resizable": "^6.11.2",
|
|
96
96
|
"react-animate-height": "^3.2.4",
|