Sanity: Error when pasting text into a nested portable text field

Created on 27 Mar 2019  路  4Comments  路  Source: sanity-io/sanity

Describe the bug

The following error is raised when pasting text from the clipboard to a nested portable text field:

Stack trace:

Error: Cannot apply deep operations on primitive values. Received patch with type "unset" and path "[object Object] that targeted the value "undefined"
    at apply (/static/js/app.bundle.js:328620:11)
    at applyPatch (/static/js/app.bundle.js:120833:33)
    at _apply (/static/js/app.bundle.js:120837:13)
    at apply (/static/js/app.bundle.js:328517:45)
    at applyPatch (/static/js/app.bundle.js:120830:32)
    at _apply (/static/js/app.bundle.js:120837:13)
    at Array.reduce (<anonymous>)
    at applyAll (/static/js/app.bundle.js:120817:18)
    at patchBlockData (/static/js/app.bundle.js:328031:48)
    at ProxyComponent.patchToOperations (/static/js/app.bundle.js:328214:14)

To Reproduce

  • Create a portable text field that allows references to objects with its own portable text field
  • Insert an object within the root-level portable text field, then try paste text into the portable text field in the modal overlay

Screenshots

Kapture 2019-03-26 at 23 08 18

Which versions of Sanity are you using?

@sanity/cli              0.140.9 (latest: 0.140.11)
@sanity/base            0.140.11 (up to date)
@sanity/code-input      0.140.10 (up to date)
@sanity/components      0.140.11 (up to date)
@sanity/core            0.140.11 (up to date)
@sanity/default-layout  0.140.11 (up to date)
@sanity/default-login    0.140.3 (up to date)
@sanity/desk-tool       0.140.11 (up to date)
@sanity/storybook        0.140.3 (up to date)
@sanity/vision          0.140.11 (up to date)

What operating system are you using?

Mac OS 10.14.3

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

6.4.1
v10.14.1

Additional context

Plain text has been copied from a HTML form field.

Document schema:

export default {
  name: 'test',
  title: 'Test',
  type: 'document',
  fields: [
    {
      name: 'title',
      title: 'Title',
      type: 'string',
    },
    {
      title: 'Body',
      name: 'body',
      type: 'array',
      of: [
        { type: 'block' },
        {
          title: 'Custom Image',
          name: 'customImage',
          type: 'object',
          fields: [
            {
              title: 'Image',
              name: 'image',
              type: 'image',
            },
            {
              title: 'Text',
              name: 'text',
              type: 'text',
            },
            {
              title: 'Portable Text',
              name: 'portableText',
              type: 'array',
              of: [{ type: 'block' }],
            },
          ],
        },
      ],
    },
  ]
}

Potentially also related to https://github.com/sanity-io/sanity-plugin-mux-input/issues/1?

Most helpful comment

It was fixed last week, but it's not released yet. Hopefully this week. Thanks for reporting!

All 4 comments

I believe this is fixed now. I'm not able to reproduce the error at least. Was this perhaps fixed in 0.140.12 @skogsmaskin?

Unfortunately I'm still seeing this in 0.140.12

Interestingly enough, the error is reproducible for me when I immediately paste text into the nested portable text field. If I enter any copy beforehand before pasting, it works as expected! GIF below:

Kapture 2019-03-31 at 23 02 29

It was fixed last week, but it's not released yet. Hopefully this week. Thanks for reporting!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

good-idea picture good-idea  路  6Comments

chanp-ark picture chanp-ark  路  3Comments

mmgj picture mmgj  路  4Comments

mickeyreiss picture mickeyreiss  路  5Comments

Svish picture Svish  路  3Comments