[IconPack] Fix incorrect initial state of packageName field in new pack mode when destination folder is selected#968
Conversation
…pack mode when destination folder is selected
WalkthroughThe pull request introduces a lifecycle 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kt (1)
105-109: ⚡ Quick winAdd a regression test for the destination → package-name bootstrap.
This bug lives in the ordering between
saveDestination()andinputHandler.init(). A small ViewModel/InputHandler test that assertsPickedState.inputFieldState.packageName.textmatches the selected folder would lock down the exact regression this PR fixes.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kt` around lines 105 - 109, Add a regression test that reproduces the ordering bug between saveDestination() and inputHandler.init(): instantiate the ViewModel, select a folder as the destination, invoke the same sequence that triggers saveDestination() and then initDefaultPack()/inputHandler.init(), and assert that the resulting state (NewPackModeState.PickedState.inputFieldState.packageName.text) equals the selected folder name; this test should specifically exercise saveDestination(), initDefaultPack(), and inputHandler.init() to lock down the correct ordering and prevent regressions.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kt`:
- Around line 105-109: Add a regression test that reproduces the ordering bug
between saveDestination() and inputHandler.init(): instantiate the ViewModel,
select a folder as the destination, invoke the same sequence that triggers
saveDestination() and then initDefaultPack()/inputHandler.init(), and assert
that the resulting state
(NewPackModeState.PickedState.inputFieldState.packageName.text) equals the
selected folder name; this test should specifically exercise saveDestination(),
initDefaultPack(), and inputHandler.init() to lock down the correct ordering and
prevent regressions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 9b9a3489-67c8-4dd7-bec3-8e8c354fd760
📒 Files selected for processing (7)
tools/idea-plugin/CHANGELOG.mdtools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/common/inputhandler/InputHandler.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ExistingPackInputHandler.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/MaterialInputHandler.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/MaterialPackViewModel.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackInputHandler.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kt
📝 Changelog
If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs: