@contentful/field-editor-reference 4.3.1 → 4.3.4

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,25 @@
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.3.4](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.3.3...@contentful/field-editor-reference@4.3.4) (2022-05-06)
7
+
8
+ ### Bug Fixes
9
+
10
+ - add a explanatory comment why we removed useCallback ([4359666](https://github.com/contentful/field-editors/commit/435966687e8e803f7e4fb20f2f7d89101d2fd20a))
11
+ - do not use callback ([811bcfd](https://github.com/contentful/field-editors/commit/811bcfda4a0fadf0701b2d6e712d1871290ebdcb))
12
+
13
+ ## [4.3.3](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.3.2...@contentful/field-editor-reference@4.3.3) (2022-05-03)
14
+
15
+ ### Bug Fixes
16
+
17
+ - avoid disabling button if no creatable content type ([#1132](https://github.com/contentful/field-editors/issues/1132)) ([72c7b97](https://github.com/contentful/field-editors/commit/72c7b97019d4a1915fd295592f0724f7be08d424))
18
+
19
+ ## [4.3.2](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.3.1...@contentful/field-editor-reference@4.3.2) (2022-04-29)
20
+
21
+ ### Bug Fixes
22
+
23
+ - use creatableContentTypes for create access check ([#1131](https://github.com/contentful/field-editors/issues/1131)) ([5fcf527](https://github.com/contentful/field-editors/commit/5fcf527609605140564eb0ba172c8877b882ebdc))
24
+
6
25
  ## [4.3.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-reference@4.3.0...@contentful/field-editor-reference@4.3.1) (2022-04-28)
7
26
 
8
27
  ### Bug Fixes
@@ -362,7 +362,7 @@ var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
362
362
  endIcon: hasDropdown ? React__default.createElement(f36Icons.ChevronDownIcon, null) : undefined,
363
363
  variant: "secondary",
364
364
  className: styles.action,
365
- isDisabled: disabled || isSelecting || contentTypes && contentTypes.length === 0,
365
+ isDisabled: disabled || isSelecting,
366
366
  startIcon: isSelecting ? undefined : plusIcon,
367
367
  size: "small",
368
368
  testId: "create-entry-link-button",
@@ -1607,8 +1607,9 @@ function useLinkActionsProps(props) {
1607
1607
  return function (_x, _x2) {
1608
1608
  return _ref.apply(this, arguments);
1609
1609
  };
1610
- }(), [sdk, entityType, onCreated]);
1611
- var onLinkExisting = React.useCallback( /*#__PURE__*/function () {
1610
+ }(), [sdk, entityType, onCreated]); // Wrapping these two with useCallback caused a bug [ZEND-2154] where CTs were not propagated to the UI at all
1611
+
1612
+ var onLinkExisting = /*#__PURE__*/function () {
1612
1613
  var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(index) {
1613
1614
  var entity;
1614
1615
  return runtime_1.wrap(function _callee2$(_context2) {
@@ -1643,11 +1644,12 @@ function useLinkActionsProps(props) {
1643
1644
  }, _callee2);
1644
1645
  }));
1645
1646
 
1646
- return function (_x3) {
1647
+ return function onLinkExisting(_x3) {
1647
1648
  return _ref2.apply(this, arguments);
1648
1649
  };
1649
- }(), [sdk, entityType, onLinkedExisting]);
1650
- var onLinkSeveralExisting = React.useCallback( /*#__PURE__*/function () {
1650
+ }();
1651
+
1652
+ var onLinkSeveralExisting = /*#__PURE__*/function () {
1651
1653
  var _ref3 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(index) {
1652
1654
  var entities;
1653
1655
  return runtime_1.wrap(function _callee3$(_context3) {
@@ -1682,10 +1684,12 @@ function useLinkActionsProps(props) {
1682
1684
  }, _callee3);
1683
1685
  }));
1684
1686
 
1685
- return function (_x4) {
1687
+ return function onLinkSeveralExisting(_x4) {
1686
1688
  return _ref3.apply(this, arguments);
1687
1689
  };
1688
- }(), [sdk, entityType, onLinkedExisting]);
1690
+ }(); // FIXME: The memoization might rerun every time due to the always changing callback identities above
1691
+
1692
+
1689
1693
  return React.useMemo(function () {
1690
1694
  return {
1691
1695
  entityType: entityType,
@@ -2294,7 +2298,7 @@ function useEditorPermissions(props) {
2294
2298
  if (entityType === 'Entry') {
2295
2299
  // Hardcoded `true` value following https://contentful.atlassian.net/browse/DANTE-486
2296
2300
  // TODO: refine permissions check in order to account for tags in rules
2297
- _canCreate = readableContentTypes.length > 0 || true;
2301
+ _canCreate = creatableContentTypes.length > 0 || true;
2298
2302
  setCanCreateEntity(_canCreate);
2299
2303
  }
2300
2304