Skip to content

Commit 02c95b9

Browse files
author
winjo
committed
feat: biz 类型改为必需
1 parent b7f5066 commit 02c95b9

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

packages/alex/src/api/createApp.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,9 @@ export function createApp({ appConfig, runtimeConfig }: IConfig): IAppInstance {
107107
// IDE 销毁时,组件会触发 handleTreeBlur,但是 FileContextKey 实例尚未初始化,此时在 dispose 阶段,injector.get(FileContextKey) 会抛出错误
108108
app.injector.get(FileTreeModelService).handleTreeBlur();
109109

110-
if (runtimeConfig?.biz) {
111-
const { biz } = runtimeConfig;
112-
setTimeout(() => {
113-
logPv(biz);
114-
});
115-
}
110+
setTimeout(() => {
111+
logPv(runtimeConfig.biz);
112+
});
116113
};
117114

118115
/**
@@ -147,7 +144,6 @@ export function createApp({ appConfig, runtimeConfig }: IConfig): IAppInstance {
147144
app.injector.disposeAll();
148145
};
149146

150-
runtimeConfig ??= {};
151147
// 基于场景的运行时数据
152148
app.injector.addProviders({
153149
token: RuntimeConfig,

packages/alex/src/api/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface IConfig {
1616
/**
1717
* 运行相关配置
1818
*/
19-
runtimeConfig?: RuntimeConfig;
19+
runtimeConfig: RuntimeConfig;
2020
}
2121

2222
export interface IAppInstance extends ClientApp {

packages/alex/src/integration/inspect/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ ReactDOM.render(
3030
workspaceDir: '/',
3131
modules: [InspectModule],
3232
}}
33+
runtimeConfig={{
34+
biz: 'inspect',
35+
}}
3336
/>,
3437
document.getElementById('main')
3538
);

packages/core/src/common/types.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ export interface CodeServiceConfig {
4141
* 同时可作为应用的全局配置,可通过类型融合来扩展字段。(https://www.typescriptlang.org/docs/handbook/declaration-merging.html)
4242
*/
4343
export interface RuntimeConfig {
44+
/*
45+
* 业务标识,用于内部埋点
46+
*/
47+
biz: string;
48+
4449
/**
4550
* 场景标识,目前用于 indexedDB store name 标识,暂不强制
4651
* 不填表示为默认场景,此时同一域名会共享 indexedDB
4752
* 如果指定为 null,表示不作为一个场景,此时不使用 indexedDB,也即不缓存工作空间及全局偏好设置等数据
4853
*/
4954
scenario?: string | null;
50-
/** 业务标识,用于内部埋点 */
51-
biz?: string;
5255
/** 工作空间配置 */
5356
workspace?: {
5457
filesystem?: FileSystemConfiguration;

0 commit comments

Comments
 (0)