You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Mobx store with two functions: loadClothetTypePrice and getClotheTypePriceReletedItems.
The loadClothetTypePrice function loads a list of cloth type prices from an API and sets them in an array called ClotheTypePriceList.
The getClotheTypePriceReletedItems function filters the ClotheTypePriceList array based on a clotheTypeID parameter and populates a separate array called clotheTypePriceFilteredDropdown with the filtered results.
When I first load the form, I call loadClothetTypePrice to populate the ClotheTypePriceList array, and then call getClotheTypePriceReletedItems to filter the results. This works correctly.
However, when I go to the list page and refresh it and when select one of the data in the list for editing it redirect me to the form page and call getClotheTypePriceReletedItems again to get the filtered results, the ClotheTypePriceList array is empty, even though I have called loadClothetTypePrice again to repopulate the array.
Mobx version
"mobx": "6.0.4",
"mobx-react-lite": "^3.2.0",
Here's an example of my code
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a Mobx store with two functions: loadClothetTypePrice and getClotheTypePriceReletedItems.
The loadClothetTypePrice function loads a list of cloth type prices from an API and sets them in an array called ClotheTypePriceList.
The getClotheTypePriceReletedItems function filters the ClotheTypePriceList array based on a clotheTypeID parameter and populates a separate array called clotheTypePriceFilteredDropdown with the filtered results.
When I first load the form, I call loadClothetTypePrice to populate the ClotheTypePriceList array, and then call getClotheTypePriceReletedItems to filter the results. This works correctly.
However, when I go to the list page and refresh it and when select one of the data in the list for editing it redirect me to the form page and call getClotheTypePriceReletedItems again to get the filtered results, the ClotheTypePriceList array is empty, even though I have called loadClothetTypePrice again to repopulate the array.
Mobx version
"mobx": "6.0.4",
"mobx-react-lite": "^3.2.0",
Here's an example of my code
I Also Tried in codesandbox working here but the data for the dropdown store are in a data.ts file not load from API
Beta Was this translation helpful? Give feedback.
All reactions