@contentful/field-editor-reference 4.6.7 → 4.6.10

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.6.10](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.6.9...@contentful/field-editor-reference@4.6.10) (2022-08-09)
7
+
8
+ ### Bug Fixes
9
+
10
+ - introduce callback to properly handle available content types [ZEND-2500] ([#1207](https://github.com/contentful/field-editors/issues/1207)) ([e6bf5e9](https://github.com/contentful/field-editors/commit/e6bf5e92e3c406a8c325d045adf907ea4e95f85f))
11
+
12
+ ## [4.6.9](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.6.8...@contentful/field-editor-reference@4.6.9) (2022-08-09)
13
+
14
+ ### Bug Fixes
15
+
16
+ - version compare [TOL-339] ([#1209](https://github.com/contentful/field-editors/issues/1209)) ([3723fd6](https://github.com/contentful/field-editors/commit/3723fd6d47c30acc6b3f8c892836d54a1303791c))
17
+
18
+ ## [4.6.8](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.6.7...@contentful/field-editor-reference@4.6.8) (2022-07-29)
19
+
20
+ **Note:** Version bump only for package @contentful/field-editor-reference
21
+
6
22
  ## [4.6.7](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.6.6...@contentful/field-editor-reference@4.6.7) (2022-07-29)
7
23
 
8
24
  **Note:** Version bump only for package @contentful/field-editor-reference
@@ -1,6 +1,8 @@
1
1
  import { Emitter } from 'mitt';
2
2
  import { FieldExtensionSDK } from '../types';
3
3
  export declare type ReferenceEditorSdkProps = {
4
+ initialValue?: any;
4
5
  validations?: any;
6
+ fetchDelay?: number;
5
7
  };
6
8
  export declare function newReferenceEditorFakeSdk(props?: ReferenceEditorSdkProps): [FieldExtensionSDK, Emitter];
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
+ import { EditorPermissions } from '../../common/useEditorPermissions';
2
3
  import { Action, ActionLabels, ContentEntityType, FieldExtensionSDK } from '../../types';
3
4
  import { LinkActionsProps } from './LinkActions';
4
- import { EditorPermissions } from '../../common/useEditorPermissions';
5
5
  declare type LinkEntityActionsProps = {
6
6
  entityType: ContentEntityType;
7
7
  canLinkMultiple: boolean;
@@ -400,6 +400,10 @@ var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
400
400
  });
401
401
  };
402
402
 
403
+ function NoLinkPermissionsInfo() {
404
+ return React__default.createElement(f36Components.Paragraph, null, "You don't have permission to view this content or this field is not correctly configured. Contact your administrator for help.");
405
+ }
406
+
403
407
  var container$1 = /*#__PURE__*/emotion.css({
404
408
  display: 'flex',
405
409
  width: '100%',
@@ -409,10 +413,6 @@ var separator = /*#__PURE__*/emotion.css({
409
413
  marginRight: tokens.spacingXl
410
414
  });
411
415
 
412
- function NoLinkPermissionsInfo() {
413
- return React__default.createElement(f36Components.Paragraph, null, "You don't have permission to view this content or this field is not correctly configured. Contact your administrator for help.");
414
- }
415
-
416
416
  var defaultEntryLabels = {
417
417
  createNew: function createNew(props) {
418
418
  return props != null && props.contentType ? "Create new " + props.contentType + " and link" : 'Create new entry and link';
@@ -1635,9 +1635,8 @@ function useLinkActionsProps(props) {
1635
1635
  return function (_x, _x2) {
1636
1636
  return _ref.apply(this, arguments);
1637
1637
  };
1638
- }(), [sdk, entityType, onCreated]); // Wrapping these two with useCallback caused a bug [ZEND-2154] where CTs were not propagated to the UI at all
1639
-
1640
- var onLinkExisting = /*#__PURE__*/function () {
1638
+ }(), [sdk, entityType, onCreated]);
1639
+ var onLinkExisting = React.useCallback( /*#__PURE__*/function () {
1641
1640
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(index) {
1642
1641
  var entity;
1643
1642
  return runtime_1.wrap(function _callee2$(_context2) {
@@ -1672,12 +1671,12 @@ function useLinkActionsProps(props) {
1672
1671
  }, _callee2);
1673
1672
  }));
1674
1673
 
1675
- return function onLinkExisting(_x3) {
1674
+ return function (_x3) {
1676
1675
  return _ref2.apply(this, arguments);
1677
1676
  };
1678
- }();
1679
-
1680
- var onLinkSeveralExisting = /*#__PURE__*/function () {
1677
+ }(), // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
1678
+ [sdk, entityType, onLinkedExisting]);
1679
+ var onLinkSeveralExisting = React.useCallback( /*#__PURE__*/function () {
1681
1680
  var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(index) {
1682
1681
  var entities;
1683
1682
  return runtime_1.wrap(function _callee3$(_context3) {
@@ -1712,11 +1711,11 @@ function useLinkActionsProps(props) {
1712
1711
  }, _callee3);
1713
1712
  }));
1714
1713
 
1715
- return function onLinkSeveralExisting(_x4) {
1714
+ return function (_x4) {
1716
1715
  return _ref3.apply(this, arguments);
1717
1716
  };
1718
- }(); // FIXME: The memoization might rerun every time due to the always changing callback identities above
1719
-
1717
+ }(), // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
1718
+ [sdk, entityType, onLinkedExisting]); // FIXME: The memoization might rerun every time due to the always changing callback identities above
1720
1719
 
1721
1720
  return React.useMemo(function () {
1722
1721
  return {
@@ -3622,6 +3621,10 @@ function FetchingWrappedAssetCard(props) {
3622
3621
  assets = _useEntities.assets;
3623
3622
 
3624
3623
  React.useEffect(function () {
3624
+ if (!props.assetId) {
3625
+ return;
3626
+ }
3627
+
3625
3628
  getAsset(props.assetId); // eslint-disable-next-line react-hooks/exhaustive-deps -- TODO: Evaluate the dependencies
3626
3629
  }, [props.assetId]);
3627
3630
  var asset = assets[props.assetId];