fix: create only one draft version per seeded page - #4119
Merged
Conversation
Alchemy::Page already builds a draft version on initialization via the ensure_draft_version after_initialize callback. The seeder built a second one explicitly, so every seeded page ended up with two draft versions. Removing the redundant build leaves exactly one draft version per page.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4119 +/- ##
==========================================
- Coverage 98.26% 98.26% -0.01%
==========================================
Files 350 350
Lines 9184 9183 -1
==========================================
- Hits 9025 9024 -1
Misses 159 159 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
Author
|
tested with alchemy demo |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation and see the Github Action logs for details |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this pull request for?
The page seeder created two draft versions for every seeded page instead of one.
Alchemy::Pagealready builds a draft version on initialization through theensure_draft_versionafter_initializecallback, butAlchemy::Seeder#create_pagealso calledpage.versions.buildexplicitly. Each seeded page therefore ended up with a redundant duplicate draft version (a demo app with 8 pages produced 23 page versions instead of the expected 15).Removing the explicit build leaves the model's callback as the single source of the draft version, so exactly one draft version is created per page. Published pages still additionally get their public version via the
public_on=setter.Notable changes (remove if none)
None.
Screenshots
Remove if no visual changes have been made.
Checklist