@contentful/field-editor-reference 6.19.0 → 6.19.1
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.
|
@@ -149,7 +149,7 @@ function handleResourceFetchError(resourceFetchError, resourceTypeEntity) {
|
|
|
149
149
|
throw resourceFetchError;
|
|
150
150
|
}
|
|
151
151
|
const isEntityQueryKey = (queryKey)=>{
|
|
152
|
-
return Array.isArray(queryKey) && (queryKey[0] === 'Entry' || queryKey[0] === 'Asset') && queryKey.length === 4;
|
|
152
|
+
return Array.isArray(queryKey) && (queryKey[0] === 'Entry' || queryKey[0] === 'Asset') && (queryKey.length === 4 || queryKey.length === 5);
|
|
153
153
|
};
|
|
154
154
|
async function fetchContentfulEntry({ urn, fetch, options }) {
|
|
155
155
|
const resourceId = urn.split(':', 6)[5];
|
|
@@ -470,10 +470,11 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = (0,
|
|
|
470
470
|
const onSlideInNavigation = props.sdk.navigator.onSlideInNavigation;
|
|
471
471
|
(0, _react.useEffect)(()=>{
|
|
472
472
|
function findSameSpaceQueries() {
|
|
473
|
-
|
|
473
|
+
const queries = queryCache.findAll({
|
|
474
474
|
type: 'active',
|
|
475
475
|
predicate: (query)=>isSameSpaceEntityQueryKey(query.queryKey)
|
|
476
476
|
});
|
|
477
|
+
return queries;
|
|
477
478
|
}
|
|
478
479
|
if (typeof onEntityChanged !== 'function') {
|
|
479
480
|
return onSlideInNavigation(({ oldSlideLevel, newSlideLevel })=>{
|
|
@@ -487,8 +488,11 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = (0,
|
|
|
487
488
|
const subscribeQuery = ({ queryKey, queryHash })=>{
|
|
488
489
|
const [entityType, entityId, , , releaseId] = queryKey;
|
|
489
490
|
entityChangeUnsubscribers.current[queryHash] = onEntityChanged(entityType, entityId, (data)=>{
|
|
490
|
-
|
|
491
|
+
const dataReleaseId = (0, _lodash.get)(data, 'sys.release.id');
|
|
492
|
+
if (dataReleaseId === releaseId) {
|
|
491
493
|
queryClient.setQueryData(queryKey, data);
|
|
494
|
+
} else if (releaseId && !dataReleaseId) {
|
|
495
|
+
void queryClient.invalidateQueries(queryKey);
|
|
492
496
|
}
|
|
493
497
|
});
|
|
494
498
|
};
|
|
@@ -61,7 +61,7 @@ function handleResourceFetchError(resourceFetchError, resourceTypeEntity) {
|
|
|
61
61
|
throw resourceFetchError;
|
|
62
62
|
}
|
|
63
63
|
const isEntityQueryKey = (queryKey)=>{
|
|
64
|
-
return Array.isArray(queryKey) && (queryKey[0] === 'Entry' || queryKey[0] === 'Asset') && queryKey.length === 4;
|
|
64
|
+
return Array.isArray(queryKey) && (queryKey[0] === 'Entry' || queryKey[0] === 'Asset') && (queryKey.length === 4 || queryKey.length === 5);
|
|
65
65
|
};
|
|
66
66
|
async function fetchContentfulEntry({ urn, fetch, options }) {
|
|
67
67
|
const resourceId = urn.split(':', 6)[5];
|
|
@@ -382,10 +382,11 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = cons
|
|
|
382
382
|
const onSlideInNavigation = props.sdk.navigator.onSlideInNavigation;
|
|
383
383
|
useEffect(()=>{
|
|
384
384
|
function findSameSpaceQueries() {
|
|
385
|
-
|
|
385
|
+
const queries = queryCache.findAll({
|
|
386
386
|
type: 'active',
|
|
387
387
|
predicate: (query)=>isSameSpaceEntityQueryKey(query.queryKey)
|
|
388
388
|
});
|
|
389
|
+
return queries;
|
|
389
390
|
}
|
|
390
391
|
if (typeof onEntityChanged !== 'function') {
|
|
391
392
|
return onSlideInNavigation(({ oldSlideLevel, newSlideLevel })=>{
|
|
@@ -399,8 +400,11 @@ const [InternalServiceProvider, useFetch, useEntityLoader, useCurrentIds] = cons
|
|
|
399
400
|
const subscribeQuery = ({ queryKey, queryHash })=>{
|
|
400
401
|
const [entityType, entityId, , , releaseId] = queryKey;
|
|
401
402
|
entityChangeUnsubscribers.current[queryHash] = onEntityChanged(entityType, entityId, (data)=>{
|
|
402
|
-
|
|
403
|
+
const dataReleaseId = get(data, 'sys.release.id');
|
|
404
|
+
if (dataReleaseId === releaseId) {
|
|
403
405
|
queryClient.setQueryData(queryKey, data);
|
|
406
|
+
} else if (releaseId && !dataReleaseId) {
|
|
407
|
+
void queryClient.invalidateQueries(queryKey);
|
|
404
408
|
}
|
|
405
409
|
});
|
|
406
410
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "6.19.
|
|
3
|
+
"version": "6.19.1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"registry": "https://npm.pkg.github.com/"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "df62d5fb562de590a6de09e86d2e72913c64ac93"
|
|
72
72
|
}
|