feat(crafting-menu): add reactive state saving and restoring#198
feat(crafting-menu): add reactive state saving and restoring#198zndxcvbn wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughCraftingMenu now persists the user's crafting list navigation state (selected category and item, scroll position, active column sorting index and state) by storing indices via SKSE during menu updates and restoring them on initialization via onUnsuspend callbacks. Persistence is driven by a debounced save mechanism triggered each frame. ChangesCrafting Menu Navigation State Persistence
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@source/actionscript/CraftingMenu/CraftingMenu.as`:
- Around line 557-606: The function saveIndices currently only writes on a
trailing debounce and can miss the final state; modify the change-detection
branch inside saveIndices (the if that compares this._lastCatIdx/... to
catIdx/itemIdx/...) to perform an immediate write using
skse.StoreIndices(this._subtypeName, [...]) when a change is detected (build the
same array of catIdx, itemIdx, scrollPos, colIdx, colState), update this._last*
fields and set this._pendingSave = false and this._indicesChangedTime =
getTimer() so the state is saved immediately while retaining or removing the
trailing debounce logic as desired; ensure abForceSave branch still calls
skse.StoreIndices when true.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 44d1da52-b001-4d60-bbb3-e2d7b0d53d9d
📒 Files selected for processing (1)
source/actionscript/CraftingMenu/CraftingMenu.as
Resolve #197.
This PR addresses an issue in the
CraftingMenuwhere the menu state was not being preserved. TheInventoryMenuutilizes a dedicated game-provided delegate for saving its state; however, theCraftingMenuis unique and lacks this delegate.Consequently, a polling-based state-saving model has been implemented to work around difficulties in intercepting the
CraftingMenuexit event. Since the Esc and Tab keys trigger prematurely, it is impossible to employ the standard state-saving model via a direct call tosaveIndices(); as a result, attempts to intercept these specific key presses simply fail.Summary by CodeRabbit