@contentful/field-editor-reference 5.30.6 → 5.30.7

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.
@@ -64,17 +64,25 @@ function useScheduledActions({ getEntityScheduledActions, entityId, entityType }
64
64
  type: 'loading'
65
65
  });
66
66
  _react.useEffect(()=>{
67
+ let mounted = true;
67
68
  getEntityScheduledActions(entityType, entityId).then((data)=>{
68
- setStatus({
69
- type: 'loaded',
70
- jobs: data
71
- });
69
+ if (mounted) {
70
+ setStatus({
71
+ type: 'loaded',
72
+ jobs: data
73
+ });
74
+ }
72
75
  }).catch((e)=>{
73
- setStatus({
74
- type: 'error',
75
- error: e
76
- });
76
+ if (mounted) {
77
+ setStatus({
78
+ type: 'error',
79
+ error: e
80
+ });
81
+ }
77
82
  });
83
+ return ()=>{
84
+ mounted = false;
85
+ };
78
86
  }, []);
79
87
  if (status.type === 'loading') {
80
88
  return {
@@ -65,6 +65,7 @@ function WrappedEntryCard(props) {
65
65
  const [file, setFile] = _react.useState(null);
66
66
  const { contentType } = props;
67
67
  _react.useEffect(()=>{
68
+ let mounted = true;
68
69
  if (props.entry) {
69
70
  getEntryImage({
70
71
  entry: props.entry,
@@ -72,11 +73,18 @@ function WrappedEntryCard(props) {
72
73
  localeCode: props.localeCode,
73
74
  defaultLocaleCode: props.defaultLocaleCode
74
75
  }, props.getAsset).then((file)=>{
75
- setFile(file);
76
+ if (mounted) {
77
+ setFile(file);
78
+ }
76
79
  }).catch(()=>{
77
- setFile(null);
80
+ if (mounted) {
81
+ setFile(null);
82
+ }
78
83
  });
79
84
  }
85
+ return ()=>{
86
+ mounted = false;
87
+ };
80
88
  }, [
81
89
  props.entry,
82
90
  props.getAsset,
@@ -5,17 +5,25 @@ export function useScheduledActions({ getEntityScheduledActions, entityId, entit
5
5
  type: 'loading'
6
6
  });
7
7
  React.useEffect(()=>{
8
+ let mounted = true;
8
9
  getEntityScheduledActions(entityType, entityId).then((data)=>{
9
- setStatus({
10
- type: 'loaded',
11
- jobs: data
12
- });
10
+ if (mounted) {
11
+ setStatus({
12
+ type: 'loaded',
13
+ jobs: data
14
+ });
15
+ }
13
16
  }).catch((e)=>{
14
- setStatus({
15
- type: 'error',
16
- error: e
17
- });
17
+ if (mounted) {
18
+ setStatus({
19
+ type: 'error',
20
+ error: e
21
+ });
22
+ }
18
23
  });
24
+ return ()=>{
25
+ mounted = false;
26
+ };
19
27
  }, []);
20
28
  if (status.type === 'loading') {
21
29
  return {
@@ -14,6 +14,7 @@ export function WrappedEntryCard(props) {
14
14
  const [file, setFile] = React.useState(null);
15
15
  const { contentType } = props;
16
16
  React.useEffect(()=>{
17
+ let mounted = true;
17
18
  if (props.entry) {
18
19
  getEntryImage({
19
20
  entry: props.entry,
@@ -21,11 +22,18 @@ export function WrappedEntryCard(props) {
21
22
  localeCode: props.localeCode,
22
23
  defaultLocaleCode: props.defaultLocaleCode
23
24
  }, props.getAsset).then((file)=>{
24
- setFile(file);
25
+ if (mounted) {
26
+ setFile(file);
27
+ }
25
28
  }).catch(()=>{
26
- setFile(null);
29
+ if (mounted) {
30
+ setFile(null);
31
+ }
27
32
  });
28
33
  }
34
+ return ()=>{
35
+ mounted = false;
36
+ };
29
37
  }, [
30
38
  props.entry,
31
39
  props.getAsset,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-reference",
3
- "version": "5.30.6",
3
+ "version": "5.30.7",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "registry": "https://npm.pkg.github.com/"
66
66
  },
67
- "gitHead": "c29381bb6d6228af3c126376d9e9218ecfc7d1bb"
67
+ "gitHead": "bf075c88a35535dd9ac930e40b49036beac98d90"
68
68
  }