fix(ui): detect VS Code from bootstrap config in shared runtime helpers
d2efa707 fixed projects-store detection via __VSCODE_CONFIG__, but
lib/desktop.isVSCodeRuntime (used by useDirectoryStore) still required
RuntimeAPIs. At webview startup that left directory init on stale
localStorage paths from other windows (#2359).
Share bootstrap detection in lib/vscodeBootstrap and use it from both
desktop runtime checks and the projects-store helper.
Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
co-authored by
Serhii Dziupin
parent
8801d69c66
commit
ccb74d8366
@@ -4,6 +4,7 @@ import type { DraftStarterRef } from '@/lib/draftStarters';
|
||||
import type { MobileKeyboardMode } from '@/lib/mobileKeyboardMode';
|
||||
import { getRuntimeApiBaseUrl, getRuntimeKey } from '@/lib/runtime-switch';
|
||||
import { getRegisteredRuntimeAPIs } from '@/contexts/runtimeAPIRegistry';
|
||||
import { isVSCodeBootstrapPresent } from '@/lib/vscodeBootstrap';
|
||||
|
||||
type ManagedRemoteTunnelPreset = {
|
||||
id: string;
|
||||
@@ -538,6 +539,12 @@ export const startDesktopWindowDrag = async (): Promise<boolean> => {
|
||||
};
|
||||
|
||||
export const isVSCodeRuntime = (): boolean => {
|
||||
// Prefer extension-host bootstrap config: it is injected in webview HTML
|
||||
// before any store module evaluates, so startup does not depend on
|
||||
// RuntimeAPIs registration order (see #2359).
|
||||
if (isVSCodeBootstrapPresent()) {
|
||||
return true;
|
||||
}
|
||||
const apis = getRegisteredRuntimeAPIs();
|
||||
return apis?.runtime?.isVSCode === true;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user