Sanity: [studio] Emoji in string field sometimes crashes document

Created on 1 Dec 2019  路  4Comments  路  Source: sanity-io/sanity

Describe the bug

After creating hundreds of documents this week we learned that you need to add emojis after you are done writing in a string field - for example a title - to avoid having the document crashing and producing 芦We're sorry, but your changes could not be applied禄.

To Reproduce

  1. Add one or several emojis in a string field and continue writing.
  2. See error: We're sorry, but your changes could not be applied

Expected behavior

Not crash. Show funny emojis.

Screenshots

sanityio-emoji-crash

Which versions of Sanity are you using?

@sanity/cli                0.146.0 (up to date)
@sanity/base               0.146.3 (up to date)
@sanity/components         0.146.3 (up to date)
@sanity/core               0.146.0 (up to date)
@sanity/default-layout     0.146.3 (up to date)
@sanity/default-login      0.146.0 (up to date)
@sanity/desk-tool          0.146.3 (up to date)
@sanity/google-maps-input  0.146.3 (up to date)
@sanity/vision             0.146.3 (up to date)

What operating system are you using?

macOS Catalina 10.15.1

Which versions of Node.js / npm are you running?

6.13.1
v13.2.0

Additional context

Screenshot is from a clean sanity init with the optional _Movie project (schema)_.

Bug UX

Most helpful comment

Thanks for reporting! This is bug in diff-match-patch from google reported here https://github.com/google/diff-match-patch/issues/59 and here鈥檚 a PR from us to fix it: https://github.com/google/diff-match-patch/pull/69. I鈥檓 not sure what the status on this is tho! But will look into it 馃槉

Edit: looks like there鈥檚 a new PR: https://github.com/google/diff-match-patch/pull/80

All 4 comments

Thanks for reporting! This is bug in diff-match-patch from google reported here https://github.com/google/diff-match-patch/issues/59 and here鈥檚 a PR from us to fix it: https://github.com/google/diff-match-patch/pull/69. I鈥檓 not sure what the status on this is tho! But will look into it 馃槉

Edit: looks like there鈥檚 a new PR: https://github.com/google/diff-match-patch/pull/80

For what it's worth we have updated Simplenote to use the patch in google/diff-match-patch#80 and it seems to working just fine for us. That's an incomplete patch because some language environments aren't fixed and there is one lingering big issue (diff-match-patch doesn't specify an encoding or guarantee that a library in Lua will work with a library in JS)

I'd be happy to have y'all test it out and let me know if something unexpectedly breaks with it. Hopefully we can get this merged into the library but I don't know when the maintainers will have a chance to interact with it.

Just an update, in case you end up using google/diff-match-patch#80 - we found some breaking cases and I'm in the process of handling them. please follow the discussion in that PR before merging into your project 馃槈

This issue is still happening at the latest version

@sanity/cli version 1.150.7
"@sanity/base": "^1.150.8",

Also this happens with text type.

Was this page helpful?
0 / 5 - 0 ratings