fix(catalog): keep the live catalog truthful after every import path
Gitea Actions Runner Test / test-job (push) Successful in 0s
CI / check (push) Successful in 29s
CI / tests-integration (push) Failing after 1m43s
CI / tests-unit (push) Successful in 1m47s
CI / tests-ui (push) Successful in 2m33s
CI / preflight (push) Skipped
CI / deploy (push) Skipped
Gitea Actions Runner Test / test-job (push) Successful in 0s
CI / check (push) Successful in 29s
CI / tests-integration (push) Failing after 1m43s
CI / tests-unit (push) Successful in 1m47s
CI / tests-ui (push) Successful in 2m33s
CI / preflight (push) Skipped
CI / deploy (push) Skipped
The live catalog store only covered part of the import surface. A durable job settled, a sync queue drained, a .nitro upload or a clone run left the Studio rail and the stats bar showing pre-import numbers until the page was reloaded, and the Catalog Manager kept a second tree that never saw writes made elsewhere in the session. Every one of those paths now pulls the tree again, and the refresh carries the totals with it: importing writes catalog rows server-side, so the counts the store holds were stale for the rest of the session. - refreshCatalogTree shares one request between concurrent callers and queues a single follow-up read when a write lands mid-flight, so a burst of edits costs at most one extra read. - useFurnitureJobs treats its first payload as a baseline, so a page load no longer replays every past import as "just settled", and hands the settled jobs to the callback. - The Catalog Manager pushes its own mutations into the store and re-reads its active tab when the store changes. - The 30s unstable_cache on the admin totals is now tagged and invalidated from every catalog write, including the import worker, so it no longer survives an import even across a hard reload. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
1 parent
d73baf1458
commit
28ce0f911c
22 files changed
+445
-70
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { existsSync, promises as fs } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { eq, sql } from "drizzle-orm";
|
||||
import { invalidateCatalogTotals } from "@/features/catalog/server/catalog-totals";
|
||||
import { apiError, apiOk } from "@/lib/api";
|
||||
import { withAdmin } from "@/lib/api-handler";
|
||||
import { db, ItemsBase, queryRows } from "@/lib/db";
|
||||
@@ -101,6 +102,7 @@ export const DELETE = withAdmin(
|
||||
} catch (err) {
|
||||
errors.push(`RCON: ${(err as Error).message}`);
|
||||
}
|
||||
invalidateCatalogTotals();
|
||||
|
||||
logAudit({
|
||||
userId: ctx.session.user.id,
|
||||
@@ -457,6 +459,7 @@ export const POST = withAdmin(
|
||||
(err as Error).message,
|
||||
);
|
||||
}
|
||||
invalidateCatalogTotals();
|
||||
|
||||
// Force offer_id to mirror its catalog row id across the tree
|
||||
const reconciled = await reconcileImportedOfferIds();
|
||||
@@ -587,6 +590,7 @@ export const POST = withAdmin(
|
||||
);
|
||||
result.warnings.push("RCON cache refresh failed");
|
||||
}
|
||||
invalidateCatalogTotals();
|
||||
|
||||
// Force offer_id to mirror its catalog row id across the tree
|
||||
const reconciled = await reconcileImportedOfferIds();
|
||||
|
||||
Reference in new issue
Block a user