fix(d3fend): use d3fend_id as expand key instead of def.id
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
Some checks failed
Aegis CI / lint-and-test (push) Has been cancelled
def.id was undefined for D3FEND items, causing expandedId===undefined to match ALL items simultaneously and opening every card at once. d3fend_id (e.g. 'D3-DSDP') is always present and unique per defense.
This commit is contained in:
@@ -880,14 +880,14 @@ function D3FENDSection({ defenses }: { defenses: Array<{
|
|||||||
)}
|
)}
|
||||||
<div className="grid gap-2 sm:grid-cols-2">
|
<div className="grid gap-2 sm:grid-cols-2">
|
||||||
{defs.map((def) => {
|
{defs.map((def) => {
|
||||||
const isExpanded = expandedId === def.id;
|
const isExpanded = expandedId === def.d3fend_id;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={def.id}
|
key={def.d3fend_id}
|
||||||
className={`rounded-lg border p-3 transition-all cursor-pointer ${
|
className={`rounded-lg border p-3 transition-all cursor-pointer ${
|
||||||
isExpanded ? "ring-1 ring-gray-600" : ""
|
isExpanded ? "ring-1 ring-gray-600" : ""
|
||||||
} ${tacticColors[tactic] || "border-gray-700 bg-gray-800/30 text-gray-300"}`}
|
} ${tacticColors[tactic] || "border-gray-700 bg-gray-800/30 text-gray-300"}`}
|
||||||
onClick={() => setExpandedId(isExpanded ? null : def.id)}
|
onClick={() => setExpandedId(isExpanded ? null : def.d3fend_id)}
|
||||||
>
|
>
|
||||||
<div className="flex items-start justify-between">
|
<div className="flex items-start justify-between">
|
||||||
<div className="min-w-0 flex-1">
|
<div className="min-w-0 flex-1">
|
||||||
|
|||||||
Reference in New Issue
Block a user