Commit 0e9756b
fix: initialize root state as an empty object if state function returns no value (#927)
* assert state to be an object
Just a moment ago had hard time debugging this code:
```js
const state = () => {}
...
new Vuex.Store({
state,
modules,
...
})
```
If state is `undefined` and you use modules, Vuex can't create store. This small change will make it easier to find this error.
* fix styling
* provide default value for state as a function1 parent 7e85915 commit 0e9756b
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
0 commit comments