CI: add a prettier GitHub action to format code automatically (#988)
* CI: add a prettier GitHub action to format code automatically * improve GitHub Action config and format some files * Apply formatting changes * CI: make the prettier action a standalone action * Apply formatting changes * CI: add push as new trigger event Co-authored-by: Mark-Fenng <Mark-Fenng@users.noreply.github.com>
This commit is contained in:
@@ -57,8 +57,8 @@ body
|
||||
|
||||
在[序列化设计](./serialization.zh_CN.md)中已经介绍了我们需要维护一个 `id -> Node` 的映射,因此当出现新增节点时,我们需要将新节点序列化并加入映射中。但由于我们为了去重新增节点,选择在所有 mutation 记录遍历完毕之后才进行序列化,在以下示例中就会出现问题:
|
||||
|
||||
1. mutation 记录1,新增节点 n1。我们暂不处理,等待最终去重后序列化。
|
||||
2. mutation 记录2,n1 新增属性 a1。我们试图将它记录成一次增量快照,但会发现无法从映射中找到 n1 对应的 id,因为此时它还未被序列化。
|
||||
1. mutation 记录 1,新增节点 n1。我们暂不处理,等待最终去重后序列化。
|
||||
2. mutation 记录 2,n1 新增属性 a1。我们试图将它记录成一次增量快照,但会发现无法从映射中找到 n1 对应的 id,因为此时它还未被序列化。
|
||||
|
||||
由此可见,由于我们对新增节点进行了延迟序列化的处理,所有 mutation 记录也都需要先收集,再新增节点去重并序列化之后再做处理。
|
||||
|
||||
@@ -119,4 +119,4 @@ function hookSetter<T>(
|
||||
}
|
||||
```
|
||||
|
||||
注意为了避免我们在 setter 中的逻辑阻塞被录制页面的正常交互,我们应该把逻辑放入 event loop 中异步执行。
|
||||
注意为了避免我们在 setter 中的逻辑阻塞被录制页面的正常交互,我们应该把逻辑放入 event loop 中异步执行。
|
||||
|
||||
Reference in New Issue
Block a user