已开启
pre-release:@react-native-ohos/react-native-mmkv-storage@1.0.0-rc.2 #23
pre-release:@react-native-ohos/react-native-mmkv-storage@1.0.0-rc.2 #23
已开启
pangzhenzhu创建于 8月9日
pangzhenzhu
pangzhenzhu
8月9日

fix: 修复持久化存储问题

likedislike
合并受阻
pangzhenzhu
pangzhenzhu
8月9日 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
8月9日 评论:

感谢提交 Pull Requests !此PR未通过DCO校验。
校验失败可能原因:

1. 未签署“DCO协议”(开发者原创声明协议),在线签署、查看签署状态。

2. Commits 中未包含 Signed-off-by信息,参考FAQ处理。

修复上述问题后,在PR的评论框输入“check dco” ,单击”评论”,系统将再次进行DCO校验。

当前检测到如下Commits 未包含Signed-off-by信息:


Thanks for submitting a pull request. This pull request has not passed the DCO check.
Possible causes:

1. You have not signed the Developer Certificate of Origin (DCO). Sign the DCO and check DCO status.

2. The commits do not contain the Signed-off-by information. To resolve this issue, see FAQs.

After resolving the preceding issues, enter check dco in the comment box of this pull request and click Comment. The system will check DCO status again.

The following commits do not contain the Signed-off-by information:

likedislike
openharmony_ciopenharmony_ci成员
8月9日 添加了label:dco检查失败
openharmony_ci
openharmony_ci成员
8月9日 评论:

该提交没有关联任何Issue,请先关联一个Issue后再触发构建
The PR is not associated with any Issue, Please associate the PR with one Issue before trigger build.

likedislike
pangzhenzhupangzhenzhu
8月9日 关联了issue:pre-release:@react-native-ohos/react-native-mmkv-storage@0.11.4-rc.1
pangzhenzhupangzhenzhu
8月9日 强制推送  1 个提交:438c3423-fix: 修复持久化存储问题
pangzhenzhu
pangzhenzhu
8月9日 评论:

check dco

likedislike
openharmony_ci
openharmony_ci成员
8月9日 评论:

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

likedislike
openharmony_ciopenharmony_ci成员
8月9日 删除了label:dco检查失败
openharmony_ciopenharmony_ci成员
8月9日 添加了label:dco检查成功
openharmony_ci
openharmony_ci成员
8月9日 评论:

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

likedislike
gyange成员8 天前进行代码检视1
src/mmkv/IDStore.ts
@@ -2,6 +2,22 @@ import { Platform } from 'react-native';
22import mmkvJsiModule from '../module';
33const STORE_ID = Platform.OS === 'ios' ? 'mmkvIdStore' : 'mmkvIDStore';
44 
5+function ensureIDStoreInitialized() {
6+ try {
7+ if (!mmkvJsiModule.getAllKeysMMKV) {
8+ return;
9+ }
10+ let keys = mmkvJsiModule.getAllKeysMMKV(STORE_ID);
11+ if (keys === undefined || keys === null) {
12+ if (mmkvJsiModule.setupMMKVInstance) {
13+ mmkvJsiModule.setupMMKVInstance(STORE_ID, 0, '', '', false);
14+ }
15+ }
16+ } catch (e) {
17+ // Silently ignore errors, the instance may not be ready yet
18+ }
19+}
20+ 
521export type StorageInstanceInfo = {
622 encrypted: boolean;
723 id: string;
@@ -12,6 +28,7 @@ export type StorageInstanceInfo = {
1228 * load the storage again.
1329 */
1430function add(id: string, encrypted?: boolean, alias?: string | null) {
gyange8 天前评论:

ensureIDStoreInitialized() 每次调用 add/encrypted/getAlias/exists/getAll 都会触发一次 getAllKeysMMKV 的原生桥调用来做检查。可以用一个模块级 boolean 标记,首次确认就绪后跳过后续 native 调用。高频读写时这个开销不低。

likedislike
gyange成员8 天前进行代码检视1
src/mmkv/IDStore.ts
@@ -8,0 +13,4 @@
13+ mmkvJsiModule.setupMMKVInstance(STORE_ID, 0, '', '', false);
14+ }
15+ }
16+ } catch (e) {
gyange8 天前评论:

catch 吞掉了所有异常,包括原生模块缺失、方法未实现等不该静默的情况。如果 setupMMKVInstance 抛错被吃掉,后续 getStringMMKV 也会失败,但真正的根因已经丢了。至少 catch 里打个 warn,或者只 catch 预期的 'instance not ready' 场景。

likedislike