Skip to content

Commit

Permalink
chore: bump version v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
geekact committed Dec 17, 2022
1 parent e574d84 commit d307482
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
## master

## [1.3.0](https://github.com/foca-js/foca/compare/v1.2.1...v1.3.0)  (2022-12-17)

- `setState` 的回调模式支持返回不完整数据

```typescript
defineModel('unique_name', {
initialState: { a: 'a', b: 'b' },
methods: {
test() {
this.setState(() => {
return { a: 'xxx' };
});
console.log(this.state); // { a: 'xxx', b: 'b' }
},
},
});
```

- 传给 reducer 的 `initialState` 不再执行深拷贝,而是在开发环境下进行冻结处理以防开发者错误操作

```typescript
const initialState = { a: 'a', b: 'b' };

defineModel('unique_name', {
initialState: initialState,
});

// 修改失败,严格模式下会报错
// TypeError: Cannot assign to read only property 'a' of object '#<Object>'
initialState.a = 'xxx';
```

## [1.2.1](https://github.com/foca-js/foca/compare/v1.2.0...v1.2.1)&nbsp;&nbsp;(2022-11-11)

- 销毁模型时可能触发`onChange`勾子
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "foca",
"version": "1.2.1",
"version": "1.3.0",
"repository": "git@github.com:foca-js/foca.git",
"homepage": "https://foca.js.org",
"keywords": [
Expand Down

0 comments on commit d307482

Please sign in to comment.