Skip to content

Commit

Permalink
Merge pull request #126 from vietredweb/Issue-52
Browse files Browse the repository at this point in the history
fixes #52 Create/Edit not load latest data
  • Loading branch information
lunguyenhat authored Feb 1, 2023
2 parents 0cc4200 + bdeb2e4 commit 8cc20ee
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ const CategoryInformation = observer(
}

async componentDidMount() {
if (!this.props.viewModel.categoryListViewModel.items.length) {
await this.props.viewModel.categoryListViewModel.handleFilter({ limit: 0 });
await this.props.viewModel.categoryListViewModel.initializeData();
}
await this.props.viewModel.categoryListViewModel.handleFilter({ limit: 0 });
await this.props.viewModel.categoryListViewModel.initializeData();
}

render() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ const CategoryTab = observer(
}

async componentDidMount() {
if (!this.fieldListViewModel.items.length) {
this.fieldListViewModel.handleFilter({ 'filter[type_id]': 61, 'filter[published]': 1 });
this.fieldListViewModel.handleFilterList({ limit: 0 });
await this.fieldListViewModel.initializeDataCustom();
this.forceUpdate();
}
this.fieldListViewModel.handleFilter({ 'filter[type_id]': 61, 'filter[published]': 1 });
this.fieldListViewModel.handleFilterList({ limit: 0 });
await this.fieldListViewModel.initializeDataCustom();
this.forceUpdate();
}
render() {
const { t, validator } = this.props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ const FieldsTab = observer(
}

async componentDidMount() {
if (!this.fieldListViewModel.items.length) {
this.fieldListViewModel.handleFilter({ 'filter[type_id]': 59, 'filter[published]': 1 });
this.fieldListViewModel.handleFilterList({ limit: 0 });
await this.fieldListViewModel.initializeDataCustom();
await this.fieldListViewModel.getGroupList();
}
this.fieldListViewModel.handleFilter({ 'filter[type_id]': 59, 'filter[published]': 1 });
this.fieldListViewModel.handleFilterList({ limit: 0 });
await this.fieldListViewModel.initializeDataCustom();
await this.fieldListViewModel.getGroupList();
this.setState({ defaultActive: 'group-' + this.fieldListViewModel.groupList[0]?.id });
}
render() {
Expand Down
6 changes: 2 additions & 4 deletions src/containers/ProductsPage/ProductEdit/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,8 @@ const EditProduct = observer(
this.formPropsData[PIM_PRODUCT_DETAIL_FIELD_KEY.ID] = this.props.match.params?.id;
await this.productDetailViewModel.initializeData();
}
if (!this.categoryListViewModel.items.length) {
await this.categoryListViewModel.handleFilter({ limit: 0 });
await this.categoryListViewModel.initializeDataCustom();
}
await this.categoryListViewModel.handleFilter({ limit: 0 });
await this.categoryListViewModel.initializeDataCustom();
}

handleAliasFormPropsData() {
Expand Down

0 comments on commit 8cc20ee

Please sign in to comment.