Skip to content

Block previews don't update when browser items are added or changed #2308

@zltn

Description

@zltn

Description

Changes to blocks with a browser don't update in the editor even after clicking done and update. The preview on the right flashes insinuating a refresh but the changes don't show up. If I open up the preview I do see the changes. Only once I exit out of the editor, refresh the edit page and open the editor again I see the changes in the previews.

Some other things I've noticed in the previews:

  • the preview of the block stays a placeholder until I add an element to the browser, once I add a single element the block preview renders (I see the blocks background) but it doesn't render the browser elements.
  • this same problems exists for blocks that have no fields at all, they don't automatically render without any fields, my workaround so far has been to add a single fields with a bogus default value. Also because it looks like the new form builder doesn't support hidden fields which would have been another workaround.
  • when using the form builder the browser shows the full model namespace under type. If I create the same browser with a form view it hide the type column and doesn't show the full model namespace

Steps to reproduce

Create a simple block with a browser fields, see below for my setup:

public function getForm(): Form
{
    return Form::make([
        Browser::make()
            ->modules([Customer::class])
            ->name('Customers')
            ->sortable(true)
            ->max(8)
    ]);
}

Create a preview blade template that includes

$block->getRelated('Customers')

Expected result

If I make changes in the browser field using the editor I would expect those changes to be directly reflected in the preview on the right.

Actual result

Changes don't show directly, only after refreshing the page, even closing and opening the editor don't make a difference

Versions

Twill version: 3.0.2
Laravel version: 10
PHP version: 8
Database engine: PG 14

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions