fix(desktop): load Mini Chat from the resolved HMR UI

Mini Chat used the API origin in HMR mode and could load the server auth page instead of the local application. Retain the resolved local UI URL and use it for Mini Chat windows.

Verified native menu zoom in main and Mini Chat windows in isolated HMR and bundled Electron profiles; Electron syntax checks passed.
This commit is contained in:
Bohdan Triapitsyn
2026-09-09 18:49:15 +03:00
parent 796eaa9546
commit 35635c0082
2 changed files with 7 additions and 1 deletions
+3 -1
View File
@@ -258,6 +258,7 @@ const { autoUpdater } = updaterPkg;
const state = {
serverHandle: null,
sidecarUrl: null,
localUiUrl: null,
localOrigin: null,
apiBaseUrl: null,
clientToken: null,
@@ -2755,7 +2756,7 @@ const createAdditionalWindow = async (url, runtimeConfig = {}) => {
const buildMiniChatUrl = ({ mode, sessionId, directory, projectId }) => {
const base = shouldUsePackagedUi()
? buildPackagedUiUrl('/mini-chat.html')
: state.localOrigin || state.sidecarUrl;
: state.localUiUrl || state.localOrigin || state.sidecarUrl;
if (!base) {
throw new Error('Local UI is not available');
}
@@ -2970,6 +2971,7 @@ const resolveInitialUrl = async () => {
: localUrl;
state.sidecarUrl = localUrl;
state.localUiUrl = localUiUrl;
const localAvailable = Boolean(localUrl);
const localOrigin = localUrl ? new URL(localUrl).origin : null;