Skip to content

Commit 87c9d9b

Browse files
committed
chore: 🤖 移除 __getRoot 接口及优化渲染注释
删除了 __getRoot 相关代码,简化根节点管理- 优化客户端渲染配置注释,提升文档可读性- 调整部分注释格式,修正中文逗号为英文逗号- 更新导出内容,移除 __getRoot 导出以保持接口一致- 修改 .gitignore,忽略 .history 文件夹- 在 VSCode 设置中添加忽略 SVN 缺失警告配置
1 parent de95c72 commit 87c9d9b

File tree

4 files changed

+12
-15
lines changed

4 files changed

+12
-15
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ test-results
2121
/playground/components.d.ts
2222
/playground/auto-imports.d.ts
2323
/playground/.eslintrc-auto-import.json
24+
25+
.history

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@
1414
},
1515
"[css]": {
1616
"editor.defaultFormatter": "biomejs.biome"
17-
}
17+
},
18+
"svn.ignoreMissingSvnWarning": true
1819
}

src/browser.tsx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ import type { ILoaderData, IRouteComponents, IRoutesById } from './types.js';
1313

1414
let root: ReactDOM.Root | null = null;
1515

16-
// react 18 some scenarios need unmount such as micro app
17-
export function __getRoot() {
18-
return root;
19-
}
20-
2116
/**
2217
* 这个组件的功能是 history 发生改变的时候重新触发渲染
2318
* @param props
@@ -84,17 +79,15 @@ export function Routes(): React.ReactElement | null {
8479
}
8580

8681
/**
87-
* umi 渲染需要的配置,在node端调用的哦
82+
* 客户端渲染需要的配置
8883
*/
8984
export type RenderClientOpts = {
9085
/**
9186
* 配置 webpack 的 publicPath。
92-
* @doc https://umijs.org/docs/api/config#publicpath
9387
*/
9488
publicPath?: string;
9589
/**
9690
* 是否是 runtimePublicPath
97-
* @doc https://umijs.org/docs/api/config#runtimepublicpath
9891
*/
9992
runtimePublicPath?: boolean;
10093
/**
@@ -120,18 +113,16 @@ export type RenderClientOpts = {
120113
*/
121114
pluginManager: any;
122115
/**
123-
* 设置路由 base,部署项目到非根目录下时使用。
124-
* @doc https://umijs.org/docs/api/config#base
116+
* 设置路由 base,部署项目到非根目录下时使用。
125117
*/
126118
basename?: string;
127119
/**
128120
* loading 中展示的组件 dom
129121
*/
130122
loadingComponent?: React.ReactNode;
131123
/**
132-
* react router 的 history,用于控制列表渲染
133-
* @doc https://umijs.org/docs/api/config#history
134-
* 有多种不同的类型,测试的时候建议用 内存路由,默认是 browserHistory
124+
* react router 的 history,用于控制路由渲染
125+
* 有多种不同的类型,测试的时候建议用 内存路由,默认是 browserHistory
135126
*/
136127
history: History;
137128
/**

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
/*
2+
* @FilePath: /winjs-renderer-react/src/index.ts
3+
*/
14
export {
25
createBrowserHistory,
36
createHashHistory,
@@ -31,7 +34,7 @@ export {
3134
useRouteProps,
3235
useSelectedRoutes,
3336
} from './appContext.js';
34-
export { __getRoot, renderClient } from './browser.js';
37+
export { renderClient } from './browser.js';
3538
export { useRouteData } from './routeContext.js';
3639
export type { ClientLoader } from './types.js';
3740
export { type RouteComponentProps, withRouter } from './withRouter.js';

0 commit comments

Comments
 (0)