Skip to content

[IconPack] Fix incorrect initial state of packageName field in new pack mode when destination folder is selected#968

Merged
egorikftp merged 1 commit into
mainfrom
buf/idea/fix-iconpack-package-suggestion
Apr 30, 2026
Merged

[IconPack] Fix incorrect initial state of packageName field in new pack mode when destination folder is selected#968
egorikftp merged 1 commit into
mainfrom
buf/idea/fix-iconpack-package-suggestion

Conversation

@egorikftp

@egorikftp egorikftp commented Apr 30, 2026

Copy link
Copy Markdown
Member

📝 Changelog

If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs:

…pack mode when destination folder is selected
@coderabbitai

coderabbitai Bot commented Apr 30, 2026

Copy link
Copy Markdown

Walkthrough

The pull request introduces a lifecycle init() method to the InputHandler interface and refactors BasicInputHandler to remove its initialState constructor parameter, always starting with an empty state. Implementation classes (ExistingPackInputHandler, MaterialInputHandler, NewPackInputHandler) are updated to either remove initialState arguments or override init() to perform lazy initialization using InMemorySettings. Corresponding view models are modified to call inputHandler.init() before accessing the input handler state. A changelog entry documents a bugfix where the initial packageName field state is now correctly set during new pack creation when users select a destination folder.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main bug fix: incorrect initial state of packageName field in new pack mode when destination folder is selected.
Description check ✅ Passed The PR description follows the template by including the changelog checklist and marking the IntelliJ Plugin checkbox as complete, matching the changes made to CHANGELOG.md.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch buf/idea/fix-iconpack-package-suggestion

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.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kt (1)

105-109: ⚡ Quick win

Add a regression test for the destination → package-name bootstrap.

This bug lives in the ordering between saveDestination() and inputHandler.init(). A small ViewModel/InputHandler test that asserts PickedState.inputFieldState.packageName.text matches 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

📥 Commits

Reviewing files that changed from the base of the PR and between fb11c42 and a50277e.

📒 Files selected for processing (7)
  • tools/idea-plugin/CHANGELOG.md
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/common/inputhandler/InputHandler.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/existingpack/ExistingPackInputHandler.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/MaterialInputHandler.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/material/MaterialPackViewModel.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackInputHandler.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/newpack/NewPackViewModel.kt

@egorikftp egorikftp merged commit b922dd0 into main Apr 30, 2026
5 checks passed
@egorikftp egorikftp deleted the buf/idea/fix-iconpack-package-suggestion branch April 30, 2026 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant