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

Adding new blocks throws "There was a problem getting the previous element." Error #967

Closed
r-anwar opened this issue Nov 18, 2024 · 8 comments

Comments

@r-anwar
Copy link

r-anwar commented Nov 18, 2024

Bug Description

When an editor creates new blocks rapidly, the NEO plugin throws the following exception:

[web.ERROR] [yii\base\Exception] There was a problem getting the previous element. {"trace":["#0 /app/vendor/spicyweb/craft-neo/src/controllers/Input.php(136): craft\services\Structures->moveAfter()","#1 [internal function]: benf\neo\controllers\Input->actionRenderBlocks()","#2 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#3 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams()","#4 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction()","#5 /app/vendor/craftcms/cms/src/web/Application.php(340): yii\base\Module->runAction()","#6 /app/vendor/craftcms/cms/src/web/Application.php(639): craft\web\Application->runAction()","#7 /app/vendor/craftcms/cms/src/web/Application.php(302): craft\web\Application->_processActionRequest()","#8 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest()","#9 /app/web/index.php(16): yii\base\Application->run()","#10 {main}"],"memory":55790784,"exception":"[object] (yii\base\Exception(code: 0): There was a problem getting the previous element. at /app/vendor/craftcms/cms/src/services/Structures.php:410)"}

This occurs when the loading icon of the previous block is still visible and the editor has already created a new block.

Steps to reproduce

  • Create a new block while the previous one is still loading, may several times.

Expected behaviour

No response

Neo version

4.2.14

Craft CMS version

4.11.3

What is the affected Neo field's propagation method?

No response

Does this issue involve templating, and if so, is eager-loading used?

This is not a templating issue

@r-anwar
Copy link
Author

r-anwar commented Nov 19, 2024

I updated to Neo version 4.2.21, still observing the error above.

@ttempleton
Copy link
Contributor

If possible, could you please send your composer.json/lock files and database backup to plugins@spicyweb.com.au, along with information about an entry where this is happening, and we'll have a look.

@ttempleton ttempleton added bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required and removed bug report status: new labels Nov 22, 2024
@ttempleton
Copy link
Contributor

Thanks for sending that in. Unfortunately I couldn't reproduce it there, but I'm guessing this generally involves some mixup with what the previous block actually is, if more than one is being created at the same time. We shouldn't really be allowing multiple block creation operations at the same time anyway, because of the possibility of issues like this, so I've made changes in the 4.x branch so that the new block buttons will be disabled while a new block is being created. I'll update here when the next release is tagged.

@r-anwar
Copy link
Author

r-anwar commented Nov 27, 2024

Thank you for your quick reply. For your information, if I create a block and wait until the block is there and then create the next one, the error occurs as well. Nevertheless, I would try the update.

@ttempleton
Copy link
Contributor

That sounds like the update won't help, then. Would it be possible for you to make a screen recording of the issue and send that in by email? I feel like there's something I'm missing that a screen recording could help me understand.

@r-anwar
Copy link
Author

r-anwar commented Nov 28, 2024

I just sent you the screen recording.

@ttempleton
Copy link
Contributor

Thanks for sending that, I can confirm receipt. We'll look further into that and I'll let you know when we have an update.

@ttempleton ttempleton added bug report status: confirmed A bug report that has been reproduced by the maintainer(s), but has not yet been fixed and removed bug report status: unconfirmed A bug report that has not yet been reproduced by the maintainer(s), and more information is required labels Dec 5, 2024
@ttempleton
Copy link
Contributor

This should be fixed now in 4.2.22, but let me know if issues persist and I'll reopen.

@ttempleton ttempleton added bug report status: fixed and removed bug report status: confirmed A bug report that has been reproduced by the maintainer(s), but has not yet been fixed labels Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants