已合并
docs: update README document for 0.77 branch of react-native-restart library #28
docs: update README document for 0.77 branch of react-native-restart library #28
已合并
fanwangah创建于 8月4日
fanwangah
8月4日

docs: update README document for 0.77 branch of react-native-restart library

likedislike
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 fanwangah 的贡献)
Ffanwangah
8月4日 关联了issue:fix: 修改react-native-restart三方库77分支AI文档质量扫描整改
openharmony_ci
openharmony_ci成员
8月4日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
openharmony_ciopenharmony_ci成员
8月4日 添加了label:dco检查成功
wupingyuan
wupingyuan
8月4日 评论:

已审视,无问题

likedislike
cpf-manager
cpf-manager8月4日进行代码检视2
README.md
@@ -219,30 +230,30 @@
230+ }}
231+ >
232+ getReason{restartReason ? `(原因:${restartReason})` : ""}
233+ </Text>
234+ );
235+ }}
236+ assert={async ({ expect, state }) => {
237+ expect(state).include("restart_");
238+ }}
239+ />
240+ </TestSuite>
241+ </Tester>
219242 );
220243}
221244 
@@ -223,9 +246,9 @@ const styles = StyleSheet.create({
223246 button: {
224247 paddingVertical: 6,
225248 paddingHorizontal: 12,
226- backgroundColor: 'hsl(193, 95%, 68%)',
249+ backgroundColor: "hsl(193, 95%, 68%)",
227250 borderWidth: 2,
228- borderColor: 'hsl(193, 95%, 30%)',
251+ borderColor: "hsl(193, 95%, 30%)",
229252 },
230253});
231254 
@@ -242,8 +265,7 @@ const styles = StyleSheet.create({
242265| Name | Description | Type | Required | Platform | HarmonyOS Support |
243266| --------- | --------------------------------- | -------- | -------- | -------- | ----------------- |
244267| restart | 重启RN工程 | Function | no | All | yes |
cpf-manager
cpf-manager8月4日评论:

【AI-Review】【一般】【软件设计】【其他软件设计问题】API 文档与代码实现不一致:Restart 方法已从文档移除但代码仍保留

● 问题:本次变更将 Restart 方法从 API 表中删除,但实际代码中 Restart 方法仍然存在并可被调用:

  • src/NativeRestart.ts 第 26 行:TurboModule Spec 接口中仍声明 Restart(reason?: string): void;
  • harmony/restart/src/main/ets/RNRestartTurboModule.ts:仍实现 public Restart = this.restart;(作为 restart 的别名)

通过 src/index.tsxexport default RNRestartRNRestart.Restart() 对用户仍可见可调用。

● 影响:文档与代码不一致。用户查阅 API 表时只能看到 restartgetReason 两个方法,但实际调用 RNRestart.Restart() 仍可正常工作。这会导致:1)用户阅读源码时发现未文档化的 API,产生困惑;2)文档无法准确反映模块对外暴露的完整接口,影响可维护性。

● 建议:二选一:

  1. Restart 已废弃,应在代码中同步移除 NativeRestart.ts 中的 Spec 声明和 RNRestartTurboModule.ts 中的 public Restart = this.restart; 实现;
  2. 若保留 Restart 用于向后兼容,应在 API 表中保留该行并标注"已废弃,推荐使用 restart"。
likedislike
fanwangah
4 天前 评论:

已修改

cpf-manager
cpf-manager8月4日进行代码检视2
README_en.md
@@ -220,30 +231,30 @@
231+ }}
232+ >
233+ getReason{restartReason ? ` (reason: ${restartReason})` : ""}
234+ </Text>
235+ );
236+ }}
237+ assert={async ({ expect, state }) => {
238+ expect(state).include("restart_");
239+ }}
240+ />
241+ </TestSuite>
242+ </Tester>
220243 );
221244}
222245 
@@ -224,9 +247,9 @@ const styles = StyleSheet.create({
224247 button: {
225248 paddingVertical: 6,
226249 paddingHorizontal: 12,
227- backgroundColor: 'hsl(193, 95%, 68%)',
250+ backgroundColor: "hsl(193, 95%, 68%)",
228251 borderWidth: 2,
229- borderColor: 'hsl(193, 95%, 30%)',
252+ borderColor: "hsl(193, 95%, 30%)",
230253 },
231254});
232255 
@@ -243,8 +266,7 @@ const styles = StyleSheet.create({
243266| Name | Description | Type | Required | Platform | HarmonyOS Support |
244267| --------- | --------------------------------- | -------- | -------- | -------- | ----------------- |
245268| restart | restart your react native project | Function | no | All | yes |
cpf-manager
cpf-manager8月4日评论:

【AI-Review】【一般】【软件设计】【其他软件设计问题】API 文档与代码实现不一致:Restart 方法已从文档移除但代码仍保留

● 问题:本次变更将 Restart 方法从 API 表中删除,但实际代码中 Restart 方法仍然存在并可被调用:

  • src/NativeRestart.ts 第 26 行:TurboModule Spec 接口中仍声明 Restart(reason?: string): void;
  • harmony/restart/src/main/ets/RNRestartTurboModule.ts:仍实现 public Restart = this.restart;(作为 restart 的别名)

通过 src/index.tsxexport default RNRestartRNRestart.Restart() 对用户仍可见可调用。

● 影响:文档与代码不一致。用户查阅 API 表时只能看到 restartgetReason 两个方法,但实际调用 RNRestart.Restart() 仍可正常工作。这会导致:1)用户阅读源码时发现未文档化的 API,产生困惑;2)文档无法准确反映模块对外暴露的完整接口,影响可维护性。

● 建议:二选一:

  1. Restart 已废弃,应在代码中同步移除 NativeRestart.ts 中的 Spec 声明和 RNRestartTurboModule.ts 中的 public Restart = this.restart; 实现;
  2. 若保留 Restart 用于向后兼容,应在 API 表中保留该行并标注"已废弃,推荐使用 restart"。
likedislike
fanwangah
4 天前 评论:

已修改

cpf-manager
cpf-manager8月4日进行代码检视3
README.md
已过期
@@ -218,0 +224,4 @@
224+ <Text
225+ style={styles.button}
226+ onPress={async () => {
227+ const reason = await RNRestart.getReason();
cpf-manager
cpf-manager8月4日评论:

【AI-Review】【建议】【基础代码问题】【稳定性问题】getReason 示例缺少 Promise rejection 处理

● 问题:示例代码中 getReason 按钮的 onPress 使用 async 函数 await RNRestart.getReason(),但未添加 try-catch 错误处理。根据 harmony/restart/src/main/ets/RNRestartTurboModule.tsgetReason() 的实现,当静态字段 restartReason 为空(即未执行过 restart)时会执行 reject('reason is empty'),而 restartReason 初始值为空字符串 ''

触发路径:用户首次进入 Demo(restartReason 初始为 '')→ 直接点击 getReason 按钮(未先点击 restart)→ getReason() 执行 reject('reason is empty')await 抛出异常 → async 函数返回 rejected Promise → 无 catch 处理 → 产生未处理的 Promise rejection。

● 影响:在用户未先点击 restart 就点击 getReason 的场景下,会产生未处理的 Promise rejection,React Native 会输出警告日志,且按钮无任何反馈(setRestartReasonsetState 均未执行),影响示例代码的健壮性。作为 README 中的参考示例,用户可能直接复制该模式到业务代码中。

● 建议:在 onPress 中添加 try-catch 处理 rejection 场景:

onPress={async () => {
  try {
    const reason = await RNRestart.getReason();
    setRestartReason(reason);
    setState(reason);
  } catch (e) {
    setRestartReason("");
    setState("");
  }
}}
likedislike
System
系统消息系统
8月4日 评论:

changed this line on 458478d7 view diff detail

fanwangah
4 天前 评论:

已修改

cpf-manager
cpf-manager8月4日进行代码检视3
README_en.md
已过期
@@ -219,0 +225,4 @@
225+ <Text
226+ style={styles.button}
227+ onPress={async () => {
228+ const reason = await RNRestart.getReason();
cpf-manager
cpf-manager8月4日评论:

【AI-Review】【建议】【基础代码问题】【稳定性问题】getReason 示例缺少 Promise rejection 处理

● 问题:示例代码中 getReason 按钮的 onPress 使用 async 函数 await RNRestart.getReason(),但未添加 try-catch 错误处理。根据 harmony/restart/src/main/ets/RNRestartTurboModule.tsgetReason() 的实现,当静态字段 restartReason 为空(即未执行过 restart)时会执行 reject('reason is empty'),而 restartReason 初始值为空字符串 ''

触发路径:用户首次进入 Demo(restartReason 初始为 '')→ 直接点击 getReason 按钮(未先点击 restart)→ getReason() 执行 reject('reason is empty')await 抛出异常 → async 函数返回 rejected Promise → 无 catch 处理 → 产生未处理的 Promise rejection。

● 影响:在用户未先点击 restart 就点击 getReason 的场景下,会产生未处理的 Promise rejection,React Native 会输出警告日志,且按钮无任何反馈(setRestartReasonsetState 均未执行),影响示例代码的健壮性。作为 README 中的参考示例,用户可能直接复制该模式到业务代码中。

● 建议:在 onPress 中添加 try-catch 处理 rejection 场景:

onPress={async () => {
  try {
    const reason = await RNRestart.getReason();
    setRestartReason(reason);
    setState(reason);
  } catch (e) {
    setRestartReason("");
    setState("");
  }
}}
likedislike
System
系统消息系统
8月4日 评论:

changed this line on 458478d7 view diff detail

fanwangah
4 天前 评论:

已修改

yangweiping
yangweiping8月4日进行代码检视2
README.md
@@ -1,1 +1,1 @@
11> 文档模板:v0.4.1
22 
yangweiping
yangweiping8月4日评论:

模板做了一些变更,后续的文档需要按照新的去更改

变更点:

  1. 版本号由0.4.1更新为0.4.2
  2. 顶部所属关系映射表,三方库版本修改为三方库版本(npm地址),链接修改为原先npm地址的链接,同时删除npm地址字段
  3. 增加源码地址字段,值为对应分支,并添加对应分支跳转链接

另外这些也一并修改下:
1.openahrmony-sig的链接修改为CPF-RN。
2.

不再支持居中,修改为p align="center"方式居中。
3.部分库链接到usage-docs,迁移后相对路径不存在,应该使用完整路径。
例如:对于未发布到npm的旧版本,请参考安装指南安装tgz包。链接应该修改为 https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/tgz-usage.md
例如:> [!TIP] 如需使用直接链接源码,请参考直接链接源码说明。链接应该修改为 https://gitcode.com/CPF-RN/usage-docs/blob/master/zh-cn/link-source-code.md

likedislike
fanwangah
4 天前 评论:

已修改

Ffanwangah
8月4日 强制推送  1 个提交:458478d7-fix: 修改react-native-restart三方库77分支AI文档质量扫描整改
openharmony_ci
openharmony_ci成员
8月4日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
fanwangah
4 天前 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
4 天前 评论:

首次触发
门禁构建开始,包含静态检查,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a311d64650f998b9cc8d4/runlist

likedislike
Ffanwangah
4 天前 修改标题为 “docs: update README document for 0.72 branch of react-native-restart library”,原标题为“fix: 修改react-native-restart三方库77分支AI文档质量扫描整改”
Ffanwangah
4 天前 修改了pull request 的描述
Ffanwangah
4 天前 修改标题为 “docs: update README document for 0.77 branch of react-native-restart library”,原标题为“docs: update README document for 0.72 branch of react-native-restart library”
openharmony_ciopenharmony_ci成员
4 天前 添加了label:静态检查失败
openharmony_ci
openharmony_ci成员
4 天前 评论:

代码门禁未通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a311d64650f998b9cc8d4/runlist

静态检查:

# check type result report
1 codeCheck noPass >>>

likedislike
fanwangah
4 天前 评论:

start build

likedislike
openharmony_ciopenharmony_ci成员
4 天前 删除了label:静态检查失败
openharmony_ci
openharmony_ci成员
4 天前 评论:

部分构建失败,仅触发失败构建
门禁构建开始,包含静态检查,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a388a64650f998b9ff947/runlist

likedislike
openharmony_ciopenharmony_ci成员
4 天前 添加了label:静态检查成功
openharmony_ciopenharmony_ci成员
4 天前 通过测试
openharmony_ci
openharmony_ci成员
4 天前 评论:

代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a388a64650f998b9ff947/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

likedislike
Ffanwangah
4 天前 测试状态已重置,测试人: openharmony_ci
Ffanwangah
4 天前 强制推送  1 个提交:db0e5a4c-docs: update README document for 0.77 branch of react-native-restart library
openharmony_ciopenharmony_ci成员
4 天前 删除了label:静态检查成功
openharmony_ci
openharmony_ci成员
4 天前 评论:

代码有更新,重置PR验证状态

likedislike
openharmony_ci
openharmony_ci成员
4 天前 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
fanwangah
4 天前 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
4 天前 评论:

本地或库上代码有更新,全量重新构建,重置所有关联PR的验证状态
门禁构建开始,包含静态检查,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a3ea564650f998ba276cc/runlist

likedislike
openharmony_ciopenharmony_ci成员
4 天前 添加了label:静态检查成功
openharmony_ciopenharmony_ci成员
4 天前 通过测试
openharmony_ci
openharmony_ci成员
4 天前 评论:

代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6a9a3ea564650f998ba276cc/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

likedislike
dingchengjiedingchengjie成员
4 天前 将dingchengjie设为审查人
dingchengjiedingchengjie成员
4 天前 通过审查
openharmony_ciopenharmony_ci成员
4 天前 关闭了关联的issue
openharmony_ciopenharmony_ci成员
4 天前 合入了pull request,合并节点 SHA:eb3c903a032d80b787b04f08660b2d24b0a893eb
openharmony_dcp
openharmony_dcp成员
4 天前 评论:

你因提交次数过多被限制提交,为保障上库效率、避免资源浪费,请先观看学习视频:https://dcp.openharmony.cn/workbench/video/videoDisplay

likedislike