fix: hide 'Neue Suche' entries from need selector chips
Only named needs (company name != 'Neue Suche') appear in the chip strip. Default active need is also the first named need, not the most-recently-created test search. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -58,11 +58,13 @@ export default function Results() {
|
||||
})
|
||||
|
||||
const allNeeds = needResp?.data ?? []
|
||||
// Only show named needs in the selector — skip auto-generated "Neue Suche" entries
|
||||
const namedNeeds = allNeeds.filter(n => n.companyName !== 'Neue Suche')
|
||||
|
||||
// Priority: explicit user selection → nav (just came from NeedBuilder) → first need in list
|
||||
const effectiveNeedId = selectedNeedId ?? activeNeedIdFromNav ?? allNeeds[0]?.id
|
||||
// Priority: explicit user selection → nav (just came from NeedBuilder) → first named need
|
||||
const effectiveNeedId = selectedNeedId ?? activeNeedIdFromNav ?? namedNeeds[0]?.id
|
||||
|
||||
const activeNeed = allNeeds.find(n => n.id === effectiveNeedId) ?? allNeeds[0]
|
||||
const activeNeed = allNeeds.find(n => n.id === effectiveNeedId) ?? namedNeeds[0]
|
||||
|
||||
// Ensure query cache is invalidated when a new need was just created
|
||||
if (activeNeedIdFromNav) {
|
||||
@@ -127,10 +129,10 @@ export default function Results() {
|
||||
<Box sx={{ flex: 1, overflowY: 'auto', px: 3, py: 3 }}>
|
||||
{activeNeed && (
|
||||
<Card sx={{ bgcolor: '#eff6ff', p: 2, mb: 2, border: '1px solid #bfdbfe' }}>
|
||||
{/* Need selector — all saved searches as chips */}
|
||||
{allNeeds.length > 1 && (
|
||||
{/* Need selector — named searches only */}
|
||||
{namedNeeds.length > 1 && (
|
||||
<Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 0.75, mb: 1.5 }}>
|
||||
{allNeeds.map(n => (
|
||||
{namedNeeds.map(n => (
|
||||
<Chip
|
||||
key={n.id}
|
||||
label={`${n.companyName} · ${n.assetType}`}
|
||||
|
||||
Reference in New Issue
Block a user