Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts power-state restoration logic during/after reboot so that a device previously in STANDBY is not incorrectly treated as ON after reboot, and adds a session-scoped guard intended to avoid re-running restoration logic on UI reloads (e.g., language changes).
Changes:
- Removes logic that forcibly converted
POWER_STATE_STANDBYtoPOWER_STATE_ONduring reboot handling. - Adds a
sessionStorageflag (powerStateRestored) to skip power-state restoration on subsequent UI reloads within the same session. - Updates
_getPowerStatebeforeReboot()to short-circuit to current power state when the session flag is set.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge remote-tracking branch 'origin/develop' into 899
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
accelerator-home-ui/src/App.js:993
sessionStorage.powerStateRestoredis set even whenappApi.setPowerState(...)reports failure (res === false). In that case the power state was not actually restored, but subsequent UI reloads will skip restoration due to the flag, potentially leaving the device/UI in an incorrect state.
sessionStorage.setItem('powerStateRestored', 'true');
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
accelerator-home-ui/src/App.js:993
powerStateRestoredis set even whenappApi.setPowerState(...)resolvesfalse(it does not reject on failure). That can cause subsequent UI reloads in the same session to skip restoration even though the power state was never successfully applied.
GLOBALS.powerState = res.currentState;
});
this.LOG("_PowerStateHandlingWhileReboot: powerstate after setting to new powerstate " + JSON.stringify(GLOBALS.powerState) + " and ");
}
sessionStorage.setItem('powerStateRestored', 'true');
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
Suppressed comments (1)
accelerator-home-ui/src/App.js:1043
- In the UI-reload short-circuit path,
getPowerState()failure currently forcesGLOBALS.powerStatetoPOWER_STATE_ON, which is inconsistent with_getPowerStateWhileReboot()(defaults toSTANDBYon error) and can incorrectly show ON when the device is actually in standby. Align the fallback state handling.
}).catch(err => {
this.LOG("_getPowerStatebeforeReboot: Error getting current power state: " + JSON.stringify(err));
GLOBALS.powerState = PowerState.POWER_STATE_ON;
});
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (1)
accelerator-home-ui/src/App.js:994
- The log line uses
GLOBALS.powerStateimmediately after triggeringappApi.getPowerState(), but the promise hasn’t resolved yet. This makes the log (and any debugging based on it) unreliable, and the call also lacks a.catch()here (unlike othergetPowerState()usages in this file). Consider logging after the state is actually read, with an error path.
appApi.getPowerState().then(res => {
GLOBALS.powerState = res.currentState;
});
this.LOG("_PowerStateHandlingWhileReboot: powerstate after setting to new powerstate " + JSON.stringify(GLOBALS.powerState) + " and ");
sessionStorage.setItem('powerStateRestored', 'true');
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Suppressed comments (2)
accelerator-home-ui/src/App.js:987
- The comment says the restored-session flag is only set after a confirmed successful restore, but the code also sets
powerStateRestoredin theres === falsebranch. This is misleading and makes it harder to reason about the intended behavior (success-only vs. "handled once per UI session").
// setPowerState resolves false when the call did not succeed, so only
// mark the state as restored after a confirmed successful restore.
accelerator-home-ui/src/App.js:994
appApi.getPowerState()is called after a successfulsetPowerState(), but the promise chain has no.catch(). IfgetPowerState()rejects, this becomes an unhandled rejection; also the subsequent log can print a staleGLOBALS.powerStatevalue because it runs before the async update completes.
appApi.getPowerState().then(res => {
GLOBALS.powerState = res.currentState;
});
this.LOG("_PowerStateHandlingWhileReboot: powerstate after setting to new powerstate " + JSON.stringify(GLOBALS.powerState) + " and ");
sessionStorage.setItem('powerStateRestored', 'true');
|
getting the checks failed so trying to raise PR again |
No description provided.