Skip to content

Commit 912c887

Browse files
committed
Use constructor.nodeType to bypass mangling
1 parent a73fd05 commit 912c887

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"@babel/plugin-transform-private-property-in-object": "^7.24.7",
99
"@emotion/react": "^11.11.4",
1010
"@emotion/styled": "^11.11.5",
11-
"@foerderfunke/matching-engine": "^1.0.4",
11+
"@foerderfunke/matching-engine": "^1.0.5",
1212
"@mui/icons-material": "^5.15.19",
1313
"@mui/material": "^5.15.19",
1414
"@mui/x-charts": "^7.6.2",

src/ui/screens/benefit-page/components/RecursiveRulesTable.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function renderNode(
1313
t
1414
) {
1515
if (!node) return null;
16-
const nodeType = node.constructor?.name;
16+
const nodeType = node.constructor?.nodeType;
1717

1818
// ROOT → skip wrapper, first AND skip label
1919
if (nodeType === 'NodeROOT') {
@@ -29,9 +29,9 @@ function renderNode(
2929
// AND / OR group
3030
if (nodeType === 'NodeAND' || nodeType === 'NodeOR') {
3131
const children = node.children || [];
32-
const dataFields = children.filter(c => c.constructor?.name === 'NodeDATAFIELD' && c.children?.length > 0);
33-
const andGroups = children.filter(c => c.constructor?.name === 'NodeAND');
34-
const orGroups = children.filter(c => c.constructor?.name === 'NodeOR');
32+
const dataFields = children.filter(c => c.constructor?.nodeType === 'NodeDATAFIELD' && c.children?.length > 0);
33+
const andGroups = children.filter(c => c.constructor?.nodeType === 'NodeAND');
34+
const orGroups = children.filter(c => c.constructor?.nodeType === 'NodeOR');
3535

3636
if (dataFields.length + andGroups.length + orGroups.length === 0) {
3737
return null;
@@ -84,8 +84,8 @@ function renderNode(
8484
if (nodeType === 'NodeDATAFIELD') {
8585
const raw = node.children || [];
8686
const rules = raw.filter(c =>
87-
c.constructor?.name === 'NodeRULE' ||
88-
c.constructor?.name === 'NodeNOT'
87+
c.constructor?.nodeType === 'NodeRULE' ||
88+
c.constructor?.nodeType === 'NodeNOT'
8989
);
9090
if (rules.length === 0) return null;
9191

src/ui/screens/benefit-page/hooks/buildFlow.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function buildFlow(graphRoot) {
1616

1717
// 1) Traverse & collect, skipping MinCount RULEs
1818
function traverse(node, depth = 0, parentId = null) {
19-
const typeName = node.constructor?.name;
19+
const typeName = node.constructor?.nodeType;
2020

2121
// ─── FILTER OUT MinCountConstraintComponent RULEs ───
2222
if (
@@ -66,14 +66,14 @@ export default function buildFlow(graphRoot) {
6666

6767
// determine label
6868
let label;
69-
if (node.constructor?.name === 'NodeRULE') {
69+
if (node.constructor?.nodeType === 'NodeRULE') {
7070
const compType = node.type || '<constraint>';
7171
const val = Array.isArray(node.value) ? node.value.join(', ') : node.value;
7272
label = `${compType}: ${val}`;
7373
} else {
74-
label = typeLabelMap[node.constructor?.name]
74+
label = typeLabelMap[node.constructor?.nodeType]
7575
?? node.path
76-
?? node.constructor?.name
76+
?? node.constructor?.nodeType
7777
?? 'node';
7878
}
7979

0 commit comments

Comments
 (0)