josdejong / josdejong/svelte-jsoneditor

Parsing JSON with duplicate keys in onChange throws "RangeError: Selection points outside of document"

Open
#331 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.3k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

Hi, I ran into this with svelte + svelte-jsoneditor v0.17.9.
When pasting in JSON with duplicate keys, this error from codemirror gets thrown: `Uncaught (in promise) RangeError: Selection points outside of document`. I noticed this started occurring on v0.17.9, but was not present on v0.17.8.
Minimal example to reproduce: https://www.sveltelab.dev/8u8l783v8eij2b1
To reproduce, paste
```json
{"a":"a", "a":"b"}
```
into the editor. An error should be thrown in the console log.
Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.