@antscorp/antsomi-ui 1.3.5-beta.152 → 1.3.5-beta.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  // Libraries
2
2
  import React, { memo, useEffect, useLayoutEffect, useState } from 'react';
3
- import { get, isArray, set } from 'lodash';
3
+ import { get, isArray, isEmpty, set } from 'lodash';
4
4
  // Locale
5
5
  import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
6
6
  import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
@@ -35,7 +35,7 @@ const Settings = (props) => {
35
35
  const isCDP = modeView === 'CDP';
36
36
  const [isInitDataCDPDone, setIsInitDataCDPDone] = useState(false);
37
37
  const contentSourcesDebounce = useDebounce(contentSources, 400);
38
- const { data: listBO, isLoading: isLoadingListBO } = useGetListBO({
38
+ const { data: listBO, isLoading: isLoadingListBO, refetch: refetchListBO, } = useGetListBO({
39
39
  url,
40
40
  }, {
41
41
  token,
@@ -43,7 +43,12 @@ const Settings = (props) => {
43
43
  accountId,
44
44
  }, {
45
45
  onSuccess(data) {
46
- if (!isInitDataCDPDone && isCDP && contentSources.groups.length === 1 && isArray(data)) {
46
+ if (!isInitDataCDPDone &&
47
+ isCDP &&
48
+ isArray(data) &&
49
+ contentSources.groups.length === 1 &&
50
+ contentSources.groups[0] &&
51
+ !contentSources.groups[0].itemTypeId) {
47
52
  const BOProduct = data.find(bo => +bo.id === PRODUCT_ITEM_TYPE_ID) || {};
48
53
  const groupId = get(contentSources, 'groups[0].groupId', '');
49
54
  const itemTypeId = BOProduct === null || BOProduct === void 0 ? void 0 : BOProduct.id;
@@ -214,12 +219,18 @@ const Settings = (props) => {
214
219
  }, [isCDP, contentSourceDispatch, groups.length]);
215
220
  // init data
216
221
  useDeepCompareEffect(() => {
217
- if (initValue) {
222
+ if (!isEmpty(initValue)) {
218
223
  contentSourceDispatch(updateContentSourceSettings(initValue));
219
224
  if (isCDP) {
220
225
  setIsInitDataCDPDone(true);
221
226
  }
222
227
  }
228
+ else {
229
+ if (isCDP) {
230
+ refetchListBO();
231
+ setIsInitDataCDPDone(false);
232
+ }
233
+ }
223
234
  }, [initValue, contentSourceDispatch, isCDP]);
224
235
  // callback data out
225
236
  useDeepCompareEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.152",
3
+ "version": "1.3.5-beta.154",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",