YYsuni / react18-json-view

JSON viewer for react18
https://jv.yysuni.com/
MIT License
236 stars 15 forks source link

fix: extra quotation marks will be added when execute edit-save action repeatly #10

Closed kamilic closed 9 months ago

kamilic commented 9 months ago

Reproduce

  1. Input a char ", and save;
  2. Click the tick icon to save, the tree node value will be ";
  3. Edit and save again, the tree node value will be """;
  4. repeat again.... quotation marks grows... :)

Fixes By trimming the extra quotes when eval(newValue) throws an error to prevent the extra quotes.

vercel[bot] commented 9 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
json-view ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 9, 2023 3:20pm
react18-json-view ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 9, 2023 3:20pm
YYsuni commented 9 months ago

Thanks for the PR👍, and putting the pure function resolveEvalFailedNewValue into the utils.ts file may be better.

kamilic commented 9 months ago

Thanks for the PR👍, and putting the pure function resolveEvalFailedNewValue into the utils.ts file may be better.

Good idea. resolveEvalFailedNewValue now moved to utils.ts.