Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify history state storage #107

Merged
merged 1 commit into from
Aug 18, 2021
Merged

Simplify history state storage #107

merged 1 commit into from
Aug 18, 2021

Conversation

PaperStrike
Copy link
Owner

Motivation and Context

Current LazyHistory API is a mess. Rewrite it and the new one looks like this:

In window.history.state:

{
  ...others,
  pjax: 1, // The index of current Pjax state in session storage
}

In window.sessionStorage.getItem('pjax') (parsed):

[
  {"scrollPos": [0,535.2000122070312]},
  {"scrollPos": [0,280.79998779296875]}, // Current Pjax state
  {"scrollPos": [0,106.4000015258789]},
]

LazyHistory lib is used to store scroll position.

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactor (no bug fix and new feature but improvements)

Checklist:

  • My change requires new tests.
  • I have added tests to cover my changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@PaperStrike PaperStrike added enhancement New feature or request minor Pull requests that require a minor version update labels Aug 18, 2021
@PaperStrike PaperStrike merged commit e55191e into main Aug 18, 2021
@PaperStrike PaperStrike deleted the lazier-history branch August 18, 2021 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor Pull requests that require a minor version update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant