Skip to content

Commit f7fae68

Browse files
committed
fix(results): stabilize sortable violation rows
1 parent 03eeaa9 commit f7fae68

3 files changed

Lines changed: 17 additions & 60 deletions

File tree

force-app/main/default/lwc/lightningFlowScanner/lightningFlowScanner.css

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/* --------------------------
22
Page Layout
33
--------------------------- */
4+
/* Full width on all tabs — no page cap */
45
.page, :host {
56
display: flex;
67
flex-direction: column;
7-
max-width: 1600px;
8-
margin: 0 auto;
8+
margin: 0;
99
padding: 0;
1010
background-color: transparent;
1111
}
@@ -49,42 +49,11 @@
4949
flex-direction: column;
5050
}
5151

52-
.all-mode-container lightning-card {
52+
/* White body joined directly to the blue toolbar above it (no border between) */
53+
.all-mode-container .table-card {
5354
background-color: #ffffff;
54-
border-radius: 0.5rem;
55+
border-radius: 0 0 0.5rem 0.5rem;
5556
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
56-
--sds-c-card-header-spacing-block-end: 0;
57-
--sds-c-card-body-spacing-block-start: 0;
58-
--sds-c-card-header-spacing-block-start: 0;
59-
}
60-
61-
.all-mode-container .slds-card__header {
62-
padding: 0 !important;
63-
background-color: #003087;
64-
}
65-
66-
.all-mode-container .slds-card__header .slds-media {
67-
width: 100% !important;
68-
}
69-
70-
.all-mode-container .slds-card__header .slds-media__body {
71-
width: 100% !important;
72-
max-width: 100% !important;
73-
}
74-
75-
.all-mode-container .slds-card__header .slds-card__header-title {
76-
width: 100% !important;
77-
max-width: 100% !important;
78-
}
79-
80-
.all-mode-container .slds-card__header .slds-truncate {
81-
overflow: visible !important;
82-
width: 100% !important;
83-
max-width: 100% !important;
84-
}
85-
86-
.all-mode-container .slds-p-around_xx-small {
87-
padding: 0.25rem 0.5rem !important;
8857
}
8958

9059
/* --------------------------
@@ -99,6 +68,7 @@
9968
color: #ffffff;
10069
margin: 0 !important;
10170
justify-content: space-between;
71+
border-radius: 0.5rem 0.5rem 0 0;
10272
}
10373

10474
.toolbar-icon {
@@ -256,25 +226,11 @@ lightning-datatable {
256226
gap: 0.5rem;
257227
}
258228

259-
.all-mode-container lightning-card .slds-card__header {
260-
padding: 0 !important;
261-
background-color: #003087;
262-
width: 100%;
263-
}
264-
265229
.all-mode-container .toolbar-row.slds-grid {
266230
margin: 0 !important;
267231
width: 100% !important;
268232
}
269233

270-
.slds-tabs_default__content {
271-
background-color: #003087;
272-
}
273-
274-
.all-mode-container lightning-card {
275-
background-color: #003087;
276-
}
277-
278234
/* --------------------------
279235
TABLE HEADER SORT INDICATORS
280236
--------------------------- */

force-app/main/default/lwc/lightningFlowScanner/lightningFlowScanner.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ <h2 class="slds-text-heading_small slds-truncate">All Results</h2>
102102
</div>
103103
</div>
104104
<!-- Table Card -->
105-
<lightning-card>
105+
<div class="table-card">
106106
<template if:true={hasFlattenedViolations}>
107107
<div class="custom-datatable">
108108
<table class="slds-table slds-table_cell-buffer full-width-table">
@@ -154,7 +154,7 @@ <h2 class="slds-text-heading_small slds-truncate">All Results</h2>
154154
</p>
155155
</template>
156156
</template>
157-
</lightning-card>
157+
</div>
158158
</template>
159159
</div>
160160
</template>

force-app/main/default/lwc/lightningFlowScanner/lightningFlowScanner.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default class LightningFlowScanner extends LightningElement {
7878

7979
// ----- SORTING -----
8080
handleSort(event) {
81-
const field = event.target.dataset.field;
81+
const field = event.currentTarget.dataset.field;
8282
if (!field) return;
8383

8484
if (this.sortField === field) {
@@ -88,20 +88,21 @@ export default class LightningFlowScanner extends LightningElement {
8888
this.sortDirection = "asc";
8989
}
9090

91-
// Update indicators
92-
this.sortIndicators = {};
93-
this.sortIndicators[field] = this.sortDirection === "asc" ? "▲" : "▼";
91+
this.sortIndicators = { [field]: this.sortDirection === "asc" ? "▲" : "▼" };
9492
}
9593

9694
// ----- FLATTENED VIOLATIONS -----
9795
get flattenedViolations() {
9896
let violations = [];
9997

100-
const processRuleDetails = (rule, ruleIndex, flowName) => {
98+
// flowKey keeps row keys unique across flows in all-mode — detail.id values
99+
// (e.g. "res-0-0") repeat per flow, and duplicate for:each keys break LWC's
100+
// list diffing when a sort reorders the rows.
101+
const processRuleDetails = (rule, ruleIndex, flowName, flowKey) => {
101102
if (!rule.details) return;
102103
rule.details.forEach((detail, detailIndex) => {
103104
violations.push({
104-
id: detail.id || `flow-${flowName}-rule-${ruleIndex}-detail-${detailIndex}`,
105+
id: `flow-${flowKey}-rule-${ruleIndex}-detail-${detailIndex}`,
105106
flowName: flowName,
106107
ruleName: rule.ruleName,
107108
severity: rule.severity,
@@ -121,7 +122,7 @@ export default class LightningFlowScanner extends LightningElement {
121122
this.allScanResults.forEach((item, itemIndex) => {
122123
const flowName = item.flowName;
123124
item.scanResult?.ruleResults?.forEach((rule, ruleIndex) =>
124-
processRuleDetails(rule, ruleIndex, flowName)
125+
processRuleDetails(rule, ruleIndex, flowName, itemIndex)
125126
);
126127
});
127128
} else {
@@ -132,7 +133,7 @@ export default class LightningFlowScanner extends LightningElement {
132133
this.selectedFlowRecord.developerName)) ||
133134
"";
134135
this.scanResult?.ruleResults?.forEach((rule, ruleIndex) =>
135-
processRuleDetails(rule, ruleIndex, flowName)
136+
processRuleDetails(rule, ruleIndex, flowName, "single")
136137
);
137138
}
138139

0 commit comments

Comments
 (0)