Skip to content

Commit

Permalink
fix(type): small type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TheNoim committed Dec 19, 2023
1 parent b3d04ec commit 78d1e45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions reactive_home/src/composeables/useLightMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,11 @@ export type UseLightMappingOptions = {
export function parseAutoEnableTimeFactory(
input?: MaybeRef<number | HassEntity | string>
) {
const defaultValue = 15 * 60 * 1000;

return computed(() => {
if (!input) {
return 15 * 60 * 1000;
return defaultValue;
}
let value = unref(input);
if (typeof value === "number") {
Expand All @@ -221,7 +223,7 @@ export function parseAutoEnableTimeFactory(
if (typeof value === "object") {
value = value.state;
}
return parse(value, "ms");
return parse(value, "ms") ?? defaultValue;
});
}

Expand Down

0 comments on commit 78d1e45

Please sign in to comment.