From e5c254dbea6cfb174ccc5606cd5337864a63467a Mon Sep 17 00:00:00 2001 From: cliffhall Date: Sun, 23 Aug 2026 00:10:10 -0400 Subject: [PATCH] perf(web): refresh the storage descriptor once per import batch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `useImportClientConfig` applies every addition and conflict sequentially, so wrapping its per-entry `onAddServer`/`onUpdateServer` in `refreshingPersist` issued one `/api/config` per imported server. On an encrypted file store each of those authenticates the whole file with a scrypt derivation (N=16384), so a 20-server import paid 20 serialized KDFs and round trips for a descriptor that cannot change more than once. Refresh on close instead: the modal must be dismissed before the settings footer that reads the descriptor can be reached, and closing also covers a partially-failed batch. `ServerImportJsonModal` is left wrapped — it adds a single server, so its one refresh is already once per batch. Closes #1950 (review round 26) Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01JTHVxSu8AUgHRLvo1ntZ8H Signed-off-by: cliffhall --- clients/web/src/App.tsx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/clients/web/src/App.tsx b/clients/web/src/App.tsx index e943a701..bfe8c38b 100644 --- a/clients/web/src/App.tsx +++ b/clients/web/src/App.tsx @@ -4612,13 +4612,21 @@ function App() { setImportConfigOpen(false)} + // Refreshed once per import batch, not per entry. `useImportClientConfig` + // applies every addition and conflict sequentially, and on an encrypted + // file store each `/api/config` authenticates the whole file with a + // scrypt derivation — so wrapping the per-entry callbacks made a + // 20-server import pay 20 serialized KDFs and round trips. Closing is + // the batch boundary: the modal must be dismissed before the settings + // footer that reads this descriptor can be reached, and closing also + // covers a partially-failed batch (#1950 review r26). + onClose={() => { + setImportConfigOpen(false); + refreshInitialConfig(); + }} onFetchSource={importSource} - onAddServer={refreshingPersist( - addServerHighlighted, - refreshInitialConfig, - )} - onUpdateServer={refreshingPersist(updateServer, refreshInitialConfig)} + onAddServer={addServerHighlighted} + onUpdateServer={updateServer} />