area17 / twill

Twill is an open source CMS toolkit for Laravel that helps developers rapidly create a custom admin console that is intuitive, powerful and flexible. Chat with us on Discord at https://discord.gg/cnWk7EFv8R.
https://twillcms.com
Apache License 2.0
3.77k stars 576 forks source link

Fix missing blockable_id on revision preview causing blockable relati… #2484

Closed emanueljacob closed 8 months ago

emanueljacob commented 8 months ago

Description

Fix preview mode when trying to preview a revision that contains a block that itself uses a blockable relation.

The fix is relatively simple: we just move the assignment of the models id to the new instance directly after creation but BEFORE hydration takes place. this way the hydration can make use of the models id and can set the blockable_id in the block relation

More information and detailed bug explanation including examples and references can be found in #2483

Related Issues

Fixes #2483 Related to #797