[codex] Fix episode selection after script generation#27
Open
RaBBBBBIT wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes episode-selection drift on the film creation page by explicitly re-selecting the intended episode after operations that reload the drama (adding an episode and generating story/scripts).
Changes:
- After adding a new episode, re-select the newly created episode by matching
episode_numberafterloadDrama(). - During story generation, preserve the user’s current episode number as the preferred target and re-select it after save/reload (fallback to the first episode if missing).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
frontweb/src/views/FilmCreate.vue |
After onAddEpisode() reloads the drama, finds the new episode by episode_number and selects it to avoid jumping back to an older episode. |
frontweb/src/composables/useStoryGeneration.js |
Preserves a preferred episode number across generation/save/reload and selects that episode after loadDrama() instead of always selecting the first. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+100
to
+104
| const preferredEp = episodesAfterSave.find((ep) => Number(ep.episode_number) === Number(preferredEpisodeNumber)) | ||
| || episodesAfterSave[0] | ||
| if (preferredEp) { | ||
| selectedEpisodeId.value = preferredEp.id | ||
| onEpisodeSelect(preferredEp.id) |
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.
Summary
Fixes episode selection state in the film creation page when users add a new episode or generate scripts from the story prompt.
Issue
When a user adds a new episode and then works from the script generation panel, the UI can jump back to the first or previous episode. This makes it look like the newly added episode did not receive the generated or saved script.
Root cause
The add-episode path saved the new episode and reloaded the drama, but did not explicitly select the newly created episode after the reload. The story-generation path also reset savedCurrentEpisodeNumber to 1 and then selected the first episode after generation, regardless of which episode the user was editing.
Fix
Validation
npm run buildinfrontwebsuccessfully.