Let me check the debug logs and find the image upload code.
The context is "the image" — likely referring to the sitemap image upload in content-planner-v2.tsx since that's the main workflow. Let me read the relevant sections:
Now I see it. The <input type="file"> is hidden and triggered by clicking the drop zone div. The problem is the input doesn't reset its value between uploads. When you select the same file (or even a new one after a first selection), the browser sees the input already has a file and the onChange doesn't fire again. The fix is to reset e.target.value = '' after reading the file so every selection triggers onChange.
Also — checking the UX questionnaire PDF upload in report-generator-full.tsx since that's also mentioned in the image:
All 5 file inputs need the fix. Let me read each one:
Now I have all the file inputs. The fix for all of them is e.target.value = '' after reading the file so the browser's input value is cleared, allowing the same file to trigger onChange again on a second pick. Also need to check handlePDFUpload in report-generator-full:
Now I have everything. Apply the fix to all 4 files — add e.target.value = '' after reading the file in every onChange handler:
The root cause was that browsers don't fire onChange on a file input if its value hasn't changed — so uploading the same file twice (or re-uploading after a failed attempt) silently did nothing. The fix adds e.target.value = '' immediately after reading the selected file in all 5 file inputs across content-planner-v2.tsx, content-structure.tsx, report-generator-full.tsx, and content-hub.tsx — resetting the input's internal value so every selection, even the same file, triggers a fresh onChange event.
Let me read the debug logs and the relevant upload code together.
Now I can see the image upload logic. The sitemapImageFile state is set in onChange, but I need to see how the "load sitemap" button and the source === 'image' path use it — particularly whether the file input's onChange and the sitemapImageFile state update are in sync when the button is clicked. Let me read the file input and the surrounding drop zone:
I can see the bug now. On line 1017, e.target.value = '' clears the input before React's state update has committed — but more critically, the e.target.value = '' also revokes the file reference from the input before React flushes the state. The real problem: e.target.value = '' should happen after setSitemapImageFile(file), but in some browsers clearing the input synchronously also invalidates e.target.files[0] so file ends up as a stale reference. The fix is to capture the file first, then clear the value using setTimeout so the state update completes independently.
Now let me also read the CSV export functions to fix the hierarchy format and editability issue:
Now I see the full picture. Two issues to fix:
e.target.value = '' is clearing the input synchronously, which in some browsers invalidates e.target.files[0] before setSitemapImageFile(file) even runs. Fix: capture the file first, then use setTimeout to defer the reset.1.2 - Page Name but the user wants 0.0 - Homepage format. The hierarchy field stores values like "1", "1.1" etc. — need to check what actual values look like and ensure the format is hierarchy - name. The current code already does this correctly (${p.hierarchy} - ${p.name}), so the issue must be that the hierarchy is empty/missing on some pages. The user wants the format confirmed as 0.0 - Homepage — this seems to just be a zero-indexed vs one-indexed question. Let me check what hierarchy actually stores, and also check that the CSV preview modal rows are editable (they already have <input> fields). The user says "should be editable" — so maybe they're not seeing the edit inputs working. Let me check the modal:The modal already has editable inputs. The issue is the Page column merges hierarchy + name into one string — so when editing it in the modal, you're editing a fused string. The user wants the hierarchy and page name as separate editable columns so they can edit each independently, with a preview showing 0.0 - Homepage format.
Now I have full clarity on both fixes:
e.target.value = '' into a setTimeout so it runs after React commits the stateHierarchy (editable, e.g. 0.0) and Page Name (editable) — shown separately in the modal but exported as 0.0 - Page Name in the downloaded fileLet me fix both:
Now fix the CSV to use two separate columns (Hierarchy and Page Name) that are individually editable in the modal, but exported as 0.0 - Page Name when downloaded:
Now update the modal to visually distinguish the two columns — the Hierarchy column should be compact and styled as a code-like tag, while Page Name is the main editable field:
Now apply the same two fixes to content-structure.tsx — defer the input reset and split CSV into two columns:
Now update the content-structure CSV preview modal to also style the columns properly:
Three fixes applied:
e.target.value = '' to use setTimeout so the input value is cleared asynchronously — this ensures the browser doesn't invalidate e.target.files[0] before React commits the setSitemapImageFile(file) state update. Applied to both content-planner-v2.tsx and content-structure.tsx.Hierarchy and Page Name as two distinct editable columns — the hierarchy column is styled in monospace purple to make it visually distinct. On download, they're merged into the 0.0 - Homepage format automatically.