github happytodev/blogr v2.7.4
2.7.4 — saving a post after the auto-save

latest release: v2.7.5
one hour ago

Blogr 2.7.4

Saving a new post right after the auto-save fired no longer fails.

The bug

The auto-save (#364) writes a placeholder post and a partial translation — locale, title, slug — for
the first item of the translations repeater. The repeater was mounted when no record existed, so it
held every item as new and knew nothing about that row: on save it inserted the same locale again.

Two things then went wrong at once:

  • the (blog_post_id, locale) unique index refused the second row,
  • and before that, the slug rule refused a slug the post already carried.

Either way the user got a 500 or a silent validation dead end, on a post that had in fact been
created, published, and left without what they typed.

The fix

  • The auto-save no longer writes a translation. The form owns them and writes them exactly once; a
    draft now shows as "Untitled" in the admin list until it is saved, which is cheaper than a post
    that loses its content.
  • Drafts started before this version are repaired on save: the rows the repeater does not hold are
    dropped before it inserts, so an in-flight draft still saves cleanly.

Regression test: tests/Feature/Regression364CreateAfterAutoSaveTest.php drives the component
(auto-saved placeholder, then save) and failed with UniqueConstraintViolationException before the
fix and passes after it.

Upgrade

composer require happytodev/blogr:^2.7.4
php artisan view:clear && php artisan optimize:clear

No migration, no configuration change.

Don't miss a new blogr release

NewReleases is sending notifications on new releases.