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:
@@ -58,7 +58,7 @@ export default function CreationPage() {
|
||||
const res = await fetch('/api/creation/execute', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ resolutions }),
|
||||
body: JSON.stringify({ resolutions, tab: selectedTab }),
|
||||
})
|
||||
if (!res.body) return
|
||||
const reader = res.body.getReader()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user