feat(useStorageAsync): AddreloadTrigger
option AND Addloaded
option AND Change key
to MaybeRefOrGetter<string>
#4155
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add
loaded
option touseStorageAsync
, Mainly addresses the issue of initial loading state determination for asynchronous stores给useStorageAsync添加loaded, 为方便获取初次是否加载成功.
修改
key
为MaybeRefOrGetter<string>
添加
reloadTrigger
选项, 用于触发再次加载配置Additional context
Asynchronous operations are slow, and with an initial value (initialValue), it's hard to determine if the asynchronous loading is complete.
异步较慢, 又有初始值(initialValue), 不好判断是否异步加载完毕.
修改
key
为MaybeRefOrGetter<string>
, 目的时在应用场景中更方便灵活目前应用场景是业务有多个模块的配置信息集中管理, 包括切换用户重新加载配置, 配置更新时也需要重新加载 开始使用的时useIDBKeyval, 后改为useStorageAsync