Skip to content

Commit

Permalink
updating substate doesn't update main state
Browse files Browse the repository at this point in the history
  • Loading branch information
yazz committed Apr 25, 2024
1 parent 44412f6 commit 9db658a
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions public/test.html
Expand Up @@ -1591,18 +1591,22 @@
vueApp.component("ZooComp",
{
props: ["statezoo"],
template: `
<div style="margin-top: 70px;">
Zoocomp {{statezoo}}
<button style="height: 050px;width:100px;" v-on:click="zoo()" >ZOO</button>
</div>`
,
data: function() {
return {
myState: {}
}
},
template: `<div style="margin-top: 70px;">
Zoocomp {{myState}}
<button style="height: 050px;width:100px;" v-on:click="zoo()" >ZOO</button>
</div>`,
methods: {
zoo: function () {
let mm = this
mm.statezoo = immer.produce(
mm.statezoo
debugger
this.myState = this.statezoo
mm.myState = immer.produce(
mm.myState
,
function(stateChange) {
stateChange.zoo.a = 2
Expand Down

0 comments on commit 9db658a

Please sign in to comment.