Skip to content

[LiveComponent] Fix bug where writable path does not respect frontend "fieldName" #720

Closed
@norkunas

Description

@norkunas

I've installed ^2.x-dev to test live component but have some issues with it.
In this test repository I've added three test components with different configurations:

  • test1: #[LiveProp(fieldName: 'data')]
    Access the form, click add/delete collection items, no errors. As soon as I try to enter a value to any input it fails with Invalid or missing checksum. This usually means that you tried to change a property that is not writable: true. (okay, so probably this is expected, as we need to expose what is writable)
  • test2: #[LiveProp(fieldName: 'data', writable: true)]
    Access the form, immediately error is thrown: An exception has been thrown during the rendering of a template ("The LiveProp path "invoice" is an object that was dehydrated to an array *and* it is writable. That's not allowed. You probably want to set writable to only the properties on your class that should be writable (e.g. writable: ['name', 'price']).").
  • test3: #[LiveProp(fieldName: 'data', writable: ['number', 'lineItems'])]
    Access the form, enter value to any input - same errors as in the first test.
    Adding a single item to collection works, adding one more or removing first one throws: The name "0.name" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").

What I miss here to make it work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions