spicywebau / craft-neo

A Matrix-like field type for Craft CMS that uses existing fields
Other
402 stars 63 forks source link

Getting Invalid Field Layout Error in CP #876

Closed brianrivet-tilt closed 5 months ago

brianrivet-tilt commented 6 months ago

Bug Description

I tried to clone a block as a start point for another block. I made the clone and adjusted the field layout. When I tried to save the field, it wouldn't save, but when I tried to access the new block type which was the one showing an error, nothing was shown in either the settings tab or the field layout tab (both were completely blank showing no fields, no labels, etc.). I then tried deleting the block type using the delete option in the gear dropdown, and it let me delete it. I saved the field afterward, and then instead of reloading the Neo field settings, I'm getting an error screen saying "Invalid field layout ID: 63". I can provide a link to a database backup an d the necessary composer files to help troubleshoot.

Steps to reproduce

  1. I cloned a block
  2. made changes to field layout on the cloned block and changed settings like the block type handle, etc.
  3. tried to save and got a message saying the block couldn't be saved.
  4. couldn't access any settings or layout on the cloned block, so deleted using the gear dropdown.
  5. tried to dave field after deleting new block
  6. Got error screen.

Expected behaviour

No response

Neo version

4.x-dev as 4.0.8

Craft CMS version

4.8.7

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

ttempleton commented 5 months ago

Firstly - the bug with the new block type's settings and field layout designer not loading is now fixed in 4.1.1, thanks for pointing that out.

Regarding the invalid field layout ID error - this has come up recently (https://github.com/spicywebau/craft-neo/issues/862), and I'm not really sure what's caused it, other than if this is another effect of the previous issue you opened in that deleting one block type using a shared field layout deletes the layout for the other block type(s). I can't reproduce the error myself, though, so I'm not sure if the sharing of field layouts is an active bug now, or was a bug in the past that is still causing some after-effects. But if sharing of field layouts is involved, then running php craft neo/block-types/fix-field-layouts should fix that.

If the error still occurs after running that, please let me know in https://github.com/spicywebau/craft-neo/issues/862 and I'll follow up from there.