Skip to content

Commit ddfad11

Browse files
committed
Ensure unique image node IDs using content digest
Appends a content digest to the generated image node ID to prevent ID collisions when nodes share the same type and parent but have different content. Improves node uniqueness and avoids potential data integrity issues during processing.
1 parent d9be055 commit ddfad11

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@libsrcdev/gatsby-remark-structured-content",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"description": "This plugin helps building thumbnails, covers, heros, carousel features from remark content.",
55
"keywords": [
66
"gatsby",

src/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export async function createMarkdownRemarkChildRemoteImageNode({
8686
const contentDigest = createContentDigest(content);
8787

8888
const childImageNode: Node = {
89-
id: createNodeId(`${nodeType} >>> ${parentNode.id}`),
89+
id: createNodeId(`${nodeType} >>> ${parentNode.id} >>> ${contentDigest}`),
9090
parent: parentNode.id,
9191
children: [],
9292
url: mdastNode.url,

0 commit comments

Comments
 (0)