Skip to content

Refactor pagination and view navigation state management#366

Merged
twisti-dev merged 6 commits into
version/26.1from
fix/view-pagination
Jun 3, 2026
Merged

Refactor pagination and view navigation state management#366
twisti-dev merged 6 commits into
version/26.1from
fix/view-pagination

Conversation

@twisti-dev
Copy link
Copy Markdown
Contributor

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

  • Added a new ViewNavigationHistory utility (ViewNavigationHistory.kt) to manage per-player navigation paths, back navigation flags, and navigation stack manipulation. This centralizes and simplifies navigation state management.
  • Refactored AbstractSurfView to use ViewNavigationHistory for 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

  • Improved pagination state updates in AbstractPaginatedSurfView by triggering a state refresh on view update, ensuring dynamic elements are properly refreshed.
  • Updated pagination glyph update logic to use the player's scheduler for both static and dynamic paginations, replacing coroutine-based scheduling for better integration with the plugin lifecycle. [1] [2]

Code Cleanup

  • Removed unused imports from AbstractSurfView.kt and AbstractPaginatedSurfView.kt to clean up the codebase. [1] [2]
  • Fixed a minor reference to ViewContainerTitleComponent.CHAR_SPACING to use the correct companion object reference.

Version Bump

  • Bumped the project version in gradle.properties from 3.17.1 to 3.17.2.

- 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
@twisti-dev twisti-dev self-assigned this Jun 3, 2026
Copilot AI review requested due to automatic review settings June 3, 2026 18:34
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 ViewNavigationHistory to centralize per-player navigation stack + “back navigation” tracking.
  • Refactored AbstractSurfView to record navigation history on open, handle “back on outside click” via the new history, and clear history on close.
  • Updated AbstractPaginatedSurfView to 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
@twisti-dev twisti-dev merged commit 7cd2588 into version/26.1 Jun 3, 2026
7 checks passed
@twisti-dev twisti-dev deleted the fix/view-pagination branch June 3, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants