Skip to content

Commit 5a8a9a9

Browse files
committed
Try to fix secondary info issue for unavailable entities
1 parent 872354d commit 5a8a9a9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/util.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { SECONDARY_INFO_VALUES, UNAVAILABLE_STATES } from './lib/constants';
1+
import { LAST_CHANGED, LAST_UPDATED, SECONDARY_INFO_VALUES, UNAVAILABLE_STATES } from './lib/constants';
22

33
export const isObject = (obj) => typeof obj === 'object' && !Array.isArray(obj) && !!obj;
44

55
export const isUnavailable = (stateObj) => !stateObj || UNAVAILABLE_STATES.includes(stateObj.state);
66

77
export const hideUnavailable = (stateObj, config) =>
88
config.hide_unavailable &&
9-
(isUnavailable(stateObj) || (config.attribute && stateObj.attributes[config.attribute] === undefined));
9+
(isUnavailable(stateObj) ||
10+
(config.attribute &&
11+
![LAST_CHANGED, LAST_UPDATED].includes(config.attribute) &&
12+
stateObj.attributes[config.attribute] === undefined));
1013

1114
export const hideIf = (stateObj, config) => {
1215
if (hideUnavailable(stateObj, config)) {

0 commit comments

Comments
 (0)