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>
15 lines
503 B
TypeScript
15 lines
503 B
TypeScript
import type { RuntimeAPIs } from '@/lib/api/types';
|
|
import {
|
|
getVSCodeBootstrapConfig,
|
|
isVSCodeBootstrapPresent,
|
|
type VSCodeBootstrapConfig,
|
|
} from '@/lib/vscodeBootstrap';
|
|
|
|
export type { VSCodeBootstrapConfig };
|
|
export { getVSCodeBootstrapConfig };
|
|
|
|
export const isVSCodeRuntime = (
|
|
runtimeApis: RuntimeAPIs | null,
|
|
bootstrapConfig: VSCodeBootstrapConfig | null = getVSCodeBootstrapConfig(),
|
|
): boolean => Boolean(isVSCodeBootstrapPresent(bootstrapConfig) || runtimeApis?.runtime?.isVSCode);
|