Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore Revision on Entity with Blocks & Nested Repeaters causing unexpected Blocks Rows #2660

Open
deckchan opened this issue Sep 24, 2024 · 3 comments

Comments

@deckchan
Copy link
Contributor

Description

When the entity contains blocks, the blocks with repeaters,
the restore revision function will cause many unexpected rows in blocks table.
And these rows will keep forever and now my production site contains several thousands rows causing very slow performance.

Steps to reproduce

Create a very simple structure to reproduce:
Make a Module eg. Page
Page Has Blocks

  • Simple Block
    • (Repeater) Simple Item
      • Input Description
      • (Repeater) Button

image

Save data like this:

  • Simple Block
    • Simple Item Test A
      • Button Test 1
      • Button Test 2
      • Button Test 3
  • Simple Block
    • Simple Item Test B
      • Button Test 4
      • Button Test 5
      • Button Test 6
  • Simple Block
    • Simple Item Test C
      • Button Test 7
      • Button Test 8
      • Button Test 9

Publish.

Database blocks would look like this:

image
which is good.

And I Edit 3 buttons, change
"Button Test 7" -> "Button Test 7 edited"
"Button Test 8" -> "Button Test 8 edited"
"Button Test 9" -> "Button Test 9 edited"

Update

Database blocks would look like this:

image
which is also good.

And we do the "restore" action to last revision.

image

Expected result

Expect result should be no additional rows are added, just normal as previous database screencap.

Actual result

However, unexpected rows are added:

image

at id (398, 399, 400, 401)

And these rows seem keep forever, and many other rows would produced everytime restore revision.

And these rows should affecting the performance.

Versions

Twill version: 2.11.0
Laravel version: v9.52.16
PHP version: PHP 8.1.23
Database engine: MySQL 8.0.30

@deckchan
Copy link
Contributor Author

Attach

resources/views/admin/blocks/simple.blade.php
resources/views/admin/pages/form.blade.php
resources/views/admin/repeaters/button.blade.php
resources/views/admin/repeaters/simple_item.blade.php

simple-blocks.zip

@zeezo887
Copy link
Collaborator

Hi @deckchan, this issue has been fixed in the latest version of Twill 2. I'd suggest you upgrade twill to 2.13.0.

@deckchan
Copy link
Contributor Author

@zeezo887

I have just tested with 2.13.0, the issue still exists

image

image

Versions

Twill version: 2.13.0

Laravel version: v9.52.16

PHP version: PHP 8.1.23

Database engine: MySQL 8.0.30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants