fix: pass tab filter to execute route so only selected family is created

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-24 15:51:47 +02:00
parent 6d8be0645d
commit 9e7423eee3
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -20,8 +20,9 @@ export async function POST(req: NextRequest) {
}
const userId = (session.user as { id: string }).id
const body = await req.json().catch(() => ({})) as { resolutions?: MetafieldResolution[] }
const body = await req.json().catch(() => ({})) as { resolutions?: MetafieldResolution[]; tab?: string }
const resolutions: MetafieldResolution[] = body.resolutions ?? []
const tabFilter: string | undefined = body.tab ?? undefined
const resolutionMap = new Map<string, MetafieldResolution>(resolutions.map(r => [r.columnHeader, r]))
const stream = new ReadableStream({
@@ -34,7 +35,7 @@ export async function POST(req: NextRequest) {
])
const alreadyCreated = new Set(existingRows.map(e => `${e.sheetTab}:${e.sheetRow}`))
const shopifyRefs = new Set(shopifyProducts.map(p => p.ref.trim().toLowerCase()))
const pending = await fetchPendingProducts(alreadyCreated)
const pending = await fetchPendingProducts(alreadyCreated, tabFilter)
const total = pending.length
if (total === 0) {