@contentful/field-editor-reference 6.13.1 → 6.13.2

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.
@@ -302,7 +302,7 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = (0,
302
302
  cmaClient
303
303
  ]);
304
304
  const isReleaseRequestError = (0, _react.useCallback)(function isReleaseRequestError(error, spaceId, environmentId) {
305
- return !!releaseId && (!spaceId || spaceId === currentSpaceId) && (!environmentId || environmentId === currentEnvironmentId) && error instanceof Error && 'status' in error && error.status === 404;
305
+ return !!releaseId && (!spaceId || spaceId === currentSpaceId) && (!environmentId || environmentId === currentEnvironmentId) && error instanceof Error && error.message.includes('The resource could not be found');
306
306
  }, [
307
307
  releaseId,
308
308
  currentSpaceId,
@@ -321,12 +321,13 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = (0,
321
321
  return fetch(queryKey, async ({ cmaClient })=>{
322
322
  if (entityType === 'Entry') {
323
323
  try {
324
- return cmaClient.entry.get({
324
+ const entity = await cmaClient.entry.get({
325
325
  entryId: entityId,
326
326
  spaceId,
327
327
  environmentId,
328
328
  releaseId
329
329
  });
330
+ return entity;
330
331
  } catch (error) {
331
332
  if (isReleaseRequestError(error, spaceId, environmentId)) {
332
333
  const currentEntry = await cmaClient.entry.get({
@@ -349,15 +350,16 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = (0,
349
350
  }
350
351
  if (entityType === 'Asset') {
351
352
  try {
352
- return cmaClient.asset.get({
353
+ const entity = await cmaClient.asset.get({
353
354
  assetId: entityId,
354
355
  spaceId,
355
356
  environmentId,
356
357
  releaseId
357
358
  });
359
+ return entity;
358
360
  } catch (error) {
359
361
  if (isReleaseRequestError(error, spaceId, environmentId)) {
360
- const currentAsset = cmaClient.asset.get({
362
+ const currentAsset = await cmaClient.asset.get({
361
363
  assetId: entityId,
362
364
  spaceId,
363
365
  environmentId,
@@ -214,7 +214,7 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = cons
214
214
  cmaClient
215
215
  ]);
216
216
  const isReleaseRequestError = useCallback(function isReleaseRequestError(error, spaceId, environmentId) {
217
- return !!releaseId && (!spaceId || spaceId === currentSpaceId) && (!environmentId || environmentId === currentEnvironmentId) && error instanceof Error && 'status' in error && error.status === 404;
217
+ return !!releaseId && (!spaceId || spaceId === currentSpaceId) && (!environmentId || environmentId === currentEnvironmentId) && error instanceof Error && error.message.includes('The resource could not be found');
218
218
  }, [
219
219
  releaseId,
220
220
  currentSpaceId,
@@ -233,12 +233,13 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = cons
233
233
  return fetch(queryKey, async ({ cmaClient })=>{
234
234
  if (entityType === 'Entry') {
235
235
  try {
236
- return cmaClient.entry.get({
236
+ const entity = await cmaClient.entry.get({
237
237
  entryId: entityId,
238
238
  spaceId,
239
239
  environmentId,
240
240
  releaseId
241
241
  });
242
+ return entity;
242
243
  } catch (error) {
243
244
  if (isReleaseRequestError(error, spaceId, environmentId)) {
244
245
  const currentEntry = await cmaClient.entry.get({
@@ -261,15 +262,16 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = cons
261
262
  }
262
263
  if (entityType === 'Asset') {
263
264
  try {
264
- return cmaClient.asset.get({
265
+ const entity = await cmaClient.asset.get({
265
266
  assetId: entityId,
266
267
  spaceId,
267
268
  environmentId,
268
269
  releaseId
269
270
  });
271
+ return entity;
270
272
  } catch (error) {
271
273
  if (isReleaseRequestError(error, spaceId, environmentId)) {
272
- const currentAsset = cmaClient.asset.get({
274
+ const currentAsset = await cmaClient.asset.get({
273
275
  assetId: entityId,
274
276
  spaceId,
275
277
  environmentId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-reference",
3
- "version": "6.13.1",
3
+ "version": "6.13.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -39,7 +39,7 @@
39
39
  "@contentful/f36-components": "^5.4.1",
40
40
  "@contentful/f36-icons": "^5.4.1",
41
41
  "@contentful/f36-tokens": "^5.1.0",
42
- "@contentful/field-editor-shared": "^2.13.1",
42
+ "@contentful/field-editor-shared": "^2.13.2",
43
43
  "@contentful/mimetype": "^2.2.29",
44
44
  "@dnd-kit/core": "^6.0.8",
45
45
  "@dnd-kit/modifiers": "^7.0.0",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "registry": "https://npm.pkg.github.com/"
69
69
  },
70
- "gitHead": "5a7e41aa7b9bbd285221f164daa777fb48cbdb01"
70
+ "gitHead": "5268c1cf0458b21d33e68126d27f8c14a2c5785d"
71
71
  }