From 303c8050080268d0d57e3b9e9417b09cb25bed3e Mon Sep 17 00:00:00 2001 From: Felipe Lalanne Date: Tue, 24 May 2022 17:37:58 -0400 Subject: [PATCH] Fix check for preloaded v2 target state --- src/device-state/preload.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/device-state/preload.ts b/src/device-state/preload.ts index fa7b856c..08e93be0 100644 --- a/src/device-state/preload.ts +++ b/src/device-state/preload.ts @@ -2,6 +2,7 @@ import * as _ from 'lodash'; import { promises as fs } from 'fs'; import { Image, imageFromService } from '../compose/images'; +import { NumericIdentifier } from '../types'; import * as deviceState from '../device-state'; import * as config from '../config'; import * as deviceConfig from '../device-config'; @@ -66,11 +67,7 @@ export async function loadTargetFromFile(appsPath: string): Promise { } // if apps.json apps are keyed by numeric ids, then convert to v3 target state - if ( - Object.keys(stateFromFile.apps || {}).some( - (appId) => !isNaN(parseInt(appId, 10)), - ) - ) { + if (Object.keys(stateFromFile.apps || {}).some(NumericIdentifier.is)) { stateFromFile = await fromV2AppsJson(stateFromFile as any); }