Skip to content

Commit e8c4145

Browse files
committed
fix: cleanup
1 parent ccb7df1 commit e8c4145

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/components/features/Feature.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,14 @@ export default function Feature({
130130
);
131131
}
132132

133-
// When parent is a list (this is when parentFeatures is not set), we don't
134-
// need to take the key of the deviceState (deviceState[feature.property])
135-
const specificDeviceState: DeviceState = parentFeatures ? (feature.property ? deviceState[feature.property] : deviceState) : deviceState;
136-
137133
return (
138134
<FeatureWrapper key={key} {...wrapperParams}>
139-
<FeatureSubFeatures feature={feature} key={key} {...genericParams} deviceState={specificDeviceState} />
135+
<FeatureSubFeatures
136+
feature={feature}
137+
key={key}
138+
{...genericParams}
139+
deviceState={feature.property ? deviceState[feature.property] : deviceState}
140+
/>
140141
</FeatureWrapper>
141142
);
142143
}

src/components/features/FeatureWrapper.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function FeatureWrapper({
3232
const unit = feature.unit as string | undefined;
3333
const [fi, fiClassName] = getFeatureIcon(feature.name, deviceValue, unit);
3434
const isReadable = onRead !== undefined && (Boolean(feature.property && feature.access & FeatureAccessMode.GET) || isColorFeature(feature));
35-
const parentFeature = parentFeatures?.[parentFeatures.length - 1];
35+
const parentFeature = parentFeatures[parentFeatures.length - 1];
3636
const featureName = feature.name === "state" ? feature.property : feature.name;
3737
let label = feature.label || startCase(featureName);
3838

0 commit comments

Comments
 (0)