Skip to content

Commit

Permalink
Fix Content Sync
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanoverna committed Dec 7, 2022
1 parent 831c04c commit d72a1e8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"build": "babel src --out-dir . --ignore __tests__",
"watch": "babel -w src --out-dir . --ignore __tests__",
"prepublish": "cross-env NODE_ENV=production yarn build",
"test-v4": "jest --forceExit",
"test": "jest --forceExit --testNamePattern='^(?!tracedSVG)'"
"test-v4": "yarn build && jest --forceExit",
"test": "yarn build && jest --forceExit --testNamePattern='^(?!tracedSVG)'"
},
"devDependencies": {
"@babel/cli": "^7.6.2",
Expand Down
39 changes: 20 additions & 19 deletions src/hooks/sourceNodes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ module.exports = async (
reporter.warn(`Invalid entity type ${entityType}`);
break;
}
changesActivity.end();
return;
} catch (err) {
if (instancePrefix) {
reporter.info(
Expand All @@ -148,28 +146,31 @@ module.exports = async (
}
}

Object.keys(loader.entitiesRepo.entities).forEach(entityType => {
loader.entitiesRepo.findEntitiesOfType(entityType).forEach(entity => {
createNodeFromEntity(entity, context);
});
changesActivity.end();
return;
}

Object.keys(loader.entitiesRepo.entities).forEach(entityType => {
loader.entitiesRepo.findEntitiesOfType(entityType).forEach(entity => {
createNodeFromEntity(entity, context);
});
});

if (process.env.NODE_ENV !== `production` && !disableLiveReload) {
const queue = new Queue(1, Infinity);
if (process.env.NODE_ENV !== `production` && !disableLiveReload) {
const queue = new Queue(1, Infinity);

loader.watch(loadPromise => {
queue.add(async () => {
const activity = reporter.activityTimer(
`detected change in DatoCMS content, loading new data`,
{ parentSpan },
);
activity.start();
loader.watch(loadPromise => {
queue.add(async () => {
const activity = reporter.activityTimer(
`detected change in DatoCMS content, loading new data`,
{ parentSpan },
);
activity.start();

await loadPromise;
await loadPromise;

activity.end();
});
activity.end();
});
}
});
}
};
4 changes: 1 addition & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@ const datocmsCreateNodeManifest = ({ node, context }) => {
const createNodeManifestIsSupported =
typeof unstable_createNodeManifest === `function`;
const updatedAt = node?.entityPayload?.meta?.updated_at;
const nodeNeedsManifestCreated = updatedAt && node?.locale;

const shouldCreateNodeManifest =
createNodeManifestIsSupported && nodeNeedsManifestCreated;
const shouldCreateNodeManifest = createNodeManifestIsSupported && updatedAt;

if (shouldCreateNodeManifest) {
if (shouldUpgradeGatsbyVersion && !warnOnceToUpgradeGatsby) {
Expand Down

0 comments on commit d72a1e8

Please sign in to comment.