-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
Intended outcome:
I want to update multiple observable arrays under the strict mode which is happening perfectly in reactjs web app but failed in electronjs project
Actual outcome:
I am getting the error below when I try to update the observable arrays in mobx store even if I wrap the mutations under the action. (runInAction() method).
This is only happening in the electronjs reactjs project but does not show up in the reactjs project.
not allowed. Please wrap the code in an `action` if this change is intended.
Tried to modify: BusinessStore@9.expenseChartData
▶ 33 stack frames were collapsed.
BusinessStore.handleExpenseMetrics
/stores/businessStore.js:188
185 | this.dashboardMetrics.totalExpenses = metricObj.totalExpenses
186 | })
187 |
> 188 | runInAction(()=>{
| ^ 189 | this.expenseChartLabels = metricObj.expenseChartLabels
190 | }) //this is just short fix for updates for many arrays in objects
191 | `
How to reproduce the issue:
It is working perfectly in the reactjs project as shown by codeSandbox
But the issue shows up in my reactjs in the electronjs shell..
@action handleDashboardMetrics(metricsObj){
runInAction(()=>{
let dashMetrics = this.dashboardMetrics;
dashMetrics.totalRevenue = metricsObj.totalRevenue
dashMetrics.totalCostSales = metricsObj.totalCostSales
dashMetrics.metricPeriod = metricsObj.metricPeriod
})
}
Versions
"mobx": "5.15.6",
"mobx-react": "6.3.0",
Please you can follow the discussion on stackoverflow via this link