@antscorp/antsomi-ui 1.3.5-beta.151 → 1.3.5-beta.153

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';
@@ -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,15 @@ 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
+ setIsInitDataCDPDone(false);
230
+ }
223
231
  }, [initValue, contentSourceDispatch, isCDP]);
224
232
  // callback data out
225
233
  useDeepCompareEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antscorp/antsomi-ui",
3
- "version": "1.3.5-beta.151",
3
+ "version": "1.3.5-beta.153",
4
4
  "description": "An enterprise-class UI design language and React UI library.",
5
5
  "sideEffects": [
6
6
  "dist/*",