HTML elements ids are incremented on different pages loaded in projectData
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)
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 🤞
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.
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 💯
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.
Issue #5584
"storage:end:load" event is not triggered when all components are mounted into the canvas
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v91 Reproducible demo link https://...
Issue #5378
Uncaught TypeError: Cannot read properties of undefined (reading 'Canvas') while dragging a component in Layer Manager Panel
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome v116.0.5845.97 Reproducible demo li...
Issue #4848
Component content is set to empty string after inline editing
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Firefox v91.4.1 Reproducible demo link htt...
Issue #6606
Editor takes a long time to load (sometimes over 1 minute)
GrapesJS version [x] I confirm to use the latest version of GrapesJS What browser are you using? Firefox Reproducible demo link https://gra...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins →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.
Tutorial
Introducing GJS.Market Services: ship your GrapesJS editor without the integration risk
It's everything that usually eats weeks of engineering time, scoped and priced up front. No open-ended hourly surprises.
Tutorial
GrapesJS custom components guide (2026)
Define custom GrapesJS components with DomComponents.addType: detection with isComponent, a model with traits and defaults, and a view for canvas behavior.
Tutorial
Building an AI-Assisted Document Engine with Next.js, GrapesJS, and the AI SDK
Transform your static template editor into an intelligent, generative design workspace with Vercel AI SDK, AI Elements and Next.js.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.