fix(studio): show all offers in the imported-furniture tree
The organize-imports route defaulted to a 500-item limit, silently hiding offers beyond the first batch of imported pages. Remove the effective cap (limit now means 'all', guarded only by a 50k lint cap) so every offer already sitting in the import tree is returned and grouped.
This commit is contained in:
1 parent
19dc0347df
commit
61c7519bea
1 file changed
+8
-4
@@ -33,10 +33,14 @@ export const GET = withAdmin(
|
|||||||
{ permission: PERMS.CATALOG_VIEW },
|
{ permission: PERMS.CATALOG_VIEW },
|
||||||
async (request) => {
|
async (request) => {
|
||||||
const sp = request.nextUrl.searchParams;
|
const sp = request.nextUrl.searchParams;
|
||||||
const limit = Math.min(
|
// No limit means "show everything" — the query is bounded by the actual
|
||||||
Math.max(Number(sp.get("limit") || 500) || 500, 1),
|
// size of the imported-furniture tree anyway. The cap only guards against
|
||||||
1000,
|
// pathological databases.
|
||||||
);
|
const rawLimit = Number(sp.get("limit"));
|
||||||
|
const limit =
|
||||||
|
Number.isFinite(rawLimit) && rawLimit > 0
|
||||||
|
? Math.min(rawLimit, 50000)
|
||||||
|
: 50000;
|
||||||
const days = Math.min(Math.max(Number(sp.get("days") || 30) || 30, 1), 365);
|
const days = Math.min(Math.max(Number(sp.get("days") || 30) || 30, 1), 365);
|
||||||
const sinceIso = new Date(
|
const sinceIso = new Date(
|
||||||
Date.now() - days * 24 * 60 * 60 * 1000,
|
Date.now() - days * 24 * 60 * 60 * 1000,
|
||||||
|
|||||||
Reference in new issue
Block a user