Closed jtsang4 closed 4 years ago
Merging #2 into master will not change coverage. The diff coverage is
n/a
.
@@ Coverage Diff @@
## master #2 +/- ##
===================================
Coverage 0% 0%
===================================
Files 6 6
Lines 40 40
Branches 5 5
===================================
Misses 40 40
Impacted Files | Coverage Δ | |
---|---|---|
src/utils/getAccessProviderContent.ts | 0% <ø> (ø) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update eb27aa8...937f8b4. Read the comment docs.
loading
处理已放到 plugin-initial-state 中
当前 PR 所做的事:
问题:
当 initial state 未加载完时,initial state 的初值是
undefined
,如果在 access.ts 中对 initial 进行解构值会造成 crash。分析:
initial state 与一般页面数据不同,可以认为整个应用都会依赖它加载完后才能进入应用逻辑,所以在加载完之前不应该继续渲染和创建 access 实例。
这样的话在 plugin-initial-state 中应将初始 loading 状态设为
true
,plugin-access 如果拿到 loading 为true
则停止往下执行,直到 loading 完成后再创建 access 实例以及往下渲染。具体做法:
增加一层
InitialStatePasser
确保 initial state 的加载和控制应用的执行渲染。