Refactor pagination and view navigation state management#366
Conversation
- call pagination.switchTo with currentPage to refresh dynamic elements
…views - change pagination state update logic to handle static views differently - use player scheduler for updating pagination glyphs in static mode
- add ViewNavigationHistory to track navigation state - update onOpen and onClose methods to manage history - refactor handleOutsideClick to utilize navigation history
…entPageIndex - change pagination state update method from currentPage() to currentPageIndex() - ensure dynamic elements refresh correctly on view updates
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b8f4ab98a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
This PR refactors the inventory framework’s view navigation and pagination behavior in the Paper module by introducing a centralized per-player navigation history and adjusting how pagination glyph/state updates are triggered.
Changes:
- Added
ViewNavigationHistoryto centralize per-player navigation stack + “back navigation” tracking. - Refactored
AbstractSurfViewto record navigation history on open, handle “back on outside click” via the new history, and clear history on close. - Updated
AbstractPaginatedSurfViewto refresh pagination state/glyphs via the player scheduler and to trigger pagination state refreshes on view updates.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| surf-api-paper/.../view/ViewNavigationHistory.kt | New shared utility for tracking per-player navigation stack and back-navigation state. |
| surf-api-paper/.../view/pagination/AbstractPaginatedSurfView.kt | Adjusts pagination glyph update scheduling and adds a pagination refresh on view updates. |
| surf-api-paper/.../view/AbstractSurfView.kt | Switches outside-click back navigation to use the new history system and updates lifecycle cleanup. |
| gradle.properties | Bumps project version from 3.17.1 to 3.17.2. |
…tate - ensure pagination object is not null before calling switchTo on currentPageIndex
This pull request introduces a new navigation history system for inventory views, refactoring how navigation state is tracked and how "back" navigation is handled. It also improves pagination state updates and removes unused imports. The most important changes are summarized below.
Navigation History System
ViewNavigationHistoryutility (ViewNavigationHistory.kt) to manage per-player navigation paths, back navigation flags, and navigation stack manipulation. This centralizes and simplifies navigation state management.AbstractSurfViewto useViewNavigationHistoryfor recording navigation history on view open, handling back navigation on outside click, and clearing navigation state on view close. This replaces previous ad-hoc navigation tracking logic. [1] [2] [3]Pagination Improvements
AbstractPaginatedSurfViewby triggering a state refresh on view update, ensuring dynamic elements are properly refreshed.Code Cleanup
AbstractSurfView.ktandAbstractPaginatedSurfView.ktto clean up the codebase. [1] [2]ViewContainerTitleComponent.CHAR_SPACINGto use the correct companion object reference.Version Bump
gradle.propertiesfrom3.17.1to3.17.2.