Error: "Duplicate use of selection JSON ID gapcursor" when using @atlaskit/editor-core in Forge app

When I using @atlaskit/editor-core in Forge app, I got an error
In package.json:

"@atlaskit/css-reset": "^6.0.1",
    "@atlaskit/editor-core": "^184.0.0",
    "@atlaskit/link-provider": "^1.6.3",
    "@atlaskit/media-core": "^34.1.2",
    "@forge/bridge": "2.5.6",
    "adf-builder": "^3.3.0",
    "next-intl": "^2.14.2",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-intl-next": "npm:react-intl@^5.18.1",
    "react-scripts": "^4.0.3"

By any chance, are you trying to serialize Editor from @atlaskit/editor-core anywhere?

I have the same problem with Editor @atlaskit/editor-core. Do you know how to fix this problem?

I can’t quite remember what the issue was exactly. But it seems like I found something that shouldn’t have been serialized, and it was added to serialization by mistake. I removed it, and an error was gone. Sorry, my comment probably won’t be helpful at this point.

1 Like

I’m working on a Connect app and had this error while using modern versions of yarn. I was previously on yarn v1, but after looking at the warnings on this page eg:

The dependencies of editor is a complex beast and can confuse some package managers (npm does not seem to result in duplicates, but yarn does).
We have encountered many strange bugs that were caused by duplicated packages in a product codebase. It is highly recommend to deduplicate packages to work around the yarn bug.
Be sure to dedupe your packages after adding or upgrading @atlaskit/editor-core in your package.json file. Our recommendation is to use yarn-deduplicate.

I decided it might be time to investigate the newer yarn versions, since as mentioned on the yarn-deduplicate page above, yarn v2 onwards has deduplication functionality natively. So it seemed like a sensible upgrade.

However it results in this error when using even the most basic implementation of the Editor component (no serialization or anything like that). From some debugging in the browser it is happening inside code from the ‘editor-common’ package, but I could find no solutions to be implemented from the app side.

Switching back to yarn v1 this error no longer happens. I’m not performing any particular deduplication, simply doing a regular yarn install. Disappointing to find such an opposite outcome to what is indicated on the editor-core page, but who knows, YMMV.