Issue #4837✓ SolvedOpened Jan 10, 2023by quentin-bettoum4 reactions

HTML elements ids are incremented on different pages loaded in projectData

Quick answerby artf2

hey @bgrand-ch I think one day all grapesjs entities will have a global uid, so in long-term, I'd expect this issue to be fixed 🤞

Read full answer below ↓

Question

GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Firefox 109 Reproducible demo link https://grapesjs.com/demo.html Describe the bug Hello, I noticed that when I load multiple pages in the projectData that have the same id used in the HTML, grapes will automatically increment the id on every page even though these are different pages. To demonstrate this issue, you will find a piece of code below where I init grapesjs with a projectData containing two pages using identical ids on some HTML tags. On the resulting HTML list, you can see the ids lik...

Answers (4)

👍 Most helpfulartfJan 27, 2025

hey @bgrand-ch I think one day all grapesjs entities will have a global uid, so in long-term, I'd expect this issue to be fixed 🤞

quentin-bettoumJan 27, 2023

At first, I wanted to generate all the pages together to have a single CSS output for all the pages. But now I'm trying another solution for the styles.

So for the id problem, generating each page separately could be a solution. Thanks for the idea.

bgrand-chSep 26, 2023

Grapes to use some data attributes (something like data-grapes-id) as unique identifiers to leave the id free for some frontend scripts.

I like this idea 💯

GJSBlockMay 17, 2026

Thanks for reporting this, @quentin-bettoum. The issue with HTML elements ids are incremented on different pages loaded in projectData appears to be a race condition or state management timing problem. This typically happens when component lifecycle events and DOM modifications overlap, creating an...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins →
Premium option

Premium plugins ship with support, regular updates, and production-ready features — save days of integration work.

Browse premium plugins →

Related tutorials

In-depth guides on the same topic.

All tutorials →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.