Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

feat(example/pager): Preserve query params when usingPicker#3760

Merged
leohhhn merged 25 commits intognolang:masterfromUrsulovic:pager-improvement
Mar 18, 2025

Conversation

Ursulovic
Copy link
Contributor

@UrsulovicUrsulovic commentedFeb 15, 2025
edited
Loading

Query Parameter Preservation in AVL Pager

This PR is necessary for theHall of Fame Improvement PR which adds sorting functionality to realms. Currently, when users navigate through pages, the sort parameter is lost because the pager doesn't preserve query parameters. This enhancement ensures that sorting preferences (and other query parameters) persist during pagination.

Goal

Enhance the current Pager implementation to preserve URL query parameters when navigating between pages. The Picker function should maintain all existing query parameters while only updating the page number.

Changes

  1. Modify thePicker function signature to accept the current path:

    func (p*Page)Picker(pathstring)string
  2. Update the Picker implementation to:

    • Parse query parameters from the provided path
    • Generate pagination UI that preserves existing query parameters
    • Maintain consistent link format across all pagination buttons

Implementation Details

  • Parse URL query parameters usingurl.Parse
  • Preserve all existing query parameters exceptpage
  • Generate pagination links that include all preserved parameters
  • Handle edge cases (invalid paths, empty queries)

Development Checklist

  • Update Pager implementation
    • Modify Picker function signature
    • Add query parameter parsing
    • Implement parameter preservation in link generation
  • Update tests
    • Add tests for query parameter preservation
    • Test edge cases and invalid inputs
  • Update dependent code
    • Modify all Picker function calls

@github-actionsgithub-actionsbot added the 🧾 package/realmTag used for new Realms or Packages. labelFeb 15, 2025
@UrsulovicUrsulovic marked this pull request as draftFebruary 15, 2025 17:40
@Gno2D2Gno2D2 requested a review froma teamFebruary 15, 2025 17:41
@Gno2D2
Copy link
Collaborator

Gno2D2 commentedFeb 15, 2025
edited by leohhhn
Loading

🛠 PR Checks Summary

AllAutomated Checks passed. ✅

Manual Checks (for Reviewers):
  • IGNORE the bot requirements for this PR (force green CI check)
  • The pull request description provides enough details
Read More

🤖 This bot helps streamline PR reviews by verifying automated checks and providing guidance for contributors and reviewers.

✅ Automated Checks (for Contributors):

🟢 Maintainers must be able to edit this pull request (more info)
🟢 Pending initial approval by a review team member, or review from tech-staff

☑️ Contributor Actions:
  1. Fix any issues flagged by automated checks.
  2. Follow the Contributor Checklist to ensure your PR is ready for review.
    • Add new tests, or document why they are unnecessary.
    • Provide clear examples/screenshots, if necessary.
    • Update documentation, if required.
    • Ensure no breaking changes, or includeBREAKING CHANGE notes.
    • Link related issues/PRs, where applicable.
☑️ Reviewer Actions:
  1. Complete manual checks for the PR, including the guidelines and additional checks if applicable.
📚 Resources:
Debug
Automated Checks
Maintainers must be able to edit this pull request (more info)

If

🟢 Condition met└── 🟢 And    ├── 🟢 The base branch matches this pattern: ^master$    └── 🟢 The pull request was created from a fork (head branch repo: Ursulovic/gno)

Then

🟢 Requirement satisfied└── 🟢 Maintainer can modify this pull request
Pending initial approval by a review team member, or review from tech-staff

If

🟢 Condition met└── 🟢 And    ├── 🟢 The base branch matches this pattern: ^master$    └── 🟢 Not (🔴 Pull request author is a member of the team: tech-staff)

Then

🟢 Requirement satisfied└── 🟢 If    ├── 🟢 Condition    │   └── 🟢 Or    │       ├── 🟢 At least 1 user(s) of the organization reviewed the pull request (with state "APPROVED")    │       ├── 🔴 At least 1 user(s) of the team tech-staff reviewed pull request    │       └── 🔴 This pull request is a draft    └── 🟢 Then        └── 🟢 Not (🔴 This label is applied to pull request: review/triage-pending)
Manual Checks
**IGNORE** the bot requirements for this PR (force green CI check)

If

🟢 Condition met└── 🟢 On every pull request

Can be checked by

  • Any user with comment edit permission
The pull request description provides enough details

If

🟢 Condition met└── 🟢 And    ├── 🟢 Not (🔴 Pull request author is a member of the team: core-contributors)    └── 🟢 Not (🔴 Pull request author is user: dependabot[bot])

Can be checked by

  • team core-contributors

@UrsulovicUrsulovic changed the titlefear(example/pager): Add Query Preservation to AVL Pagerfear(example/pager): Add Query Preservation to AVL Pager 3760Feb 15, 2025
@UrsulovicUrsulovic changed the titlefear(example/pager): Add Query Preservation to AVL Pager 3760fear(example/pager): Add Query Preservation to AVL Pager #3760Feb 15, 2025
@UrsulovicUrsulovic changed the titlefear(example/pager): Add Query Preservation to AVL Pager #3760fear(example/pager): Add Query Preservation to AVL PagerFeb 15, 2025
@UrsulovicUrsulovic changed the titlefear(example/pager): Add Query Preservation to AVL Pagerfeat(example/pager): Add Query Preservation to AVL PagerFeb 15, 2025
@UrsulovicUrsulovic marked this pull request as ready for reviewFebruary 16, 2025 10:58
@Gno2D2Gno2D2 added the review/triage-pendingPRs opened by external contributors that are waiting for the 1st review labelFeb 16, 2025
@notJoon
Copy link
Member

The CI is failing in lint. Could you please resolve this? Thank you.

@codecovCodecov
Copy link

codecovbot commentedFeb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report?Let us know!

@Ursulovic
Copy link
ContributorAuthor

The CI is failing in lint. Could you please resolve this? Thank you.

Hi, several days ago, there was a problem with the CI, and I was told to leave it for the time being. It fixed itself when merged with master in this commit:458a825.

leohhhn reacted with thumbs up emoji

@leohhhnleohhhn self-requested a reviewFebruary 19, 2025 10:56
@leohhhnleohhhn changed the titlefeat(example/pager): Add Query Preservation to AVL Pagerfeat(example/pager): Preserve query params when usingPickerFeb 24, 2025
@leohhhn
Copy link
Contributor

It seems to me that there is something wrong with this PR, but I cannot put a finger on it without more digging.

If you can try and actually use this in a realm, with specific render paths, or query params, it fails. I created a simple asc/desc query rendering for r/docs/minisocial and the picker didn't work properly.

@leohhhn
Copy link
Contributor

leohhhn commentedMar 17, 2025
edited
Loading

Please also look into the txtar tests and add the Picker argument to the source there (to fix the CI).

@github-actionsgithub-actionsbot added the 📦 ⛰️ gno.landIssues or PRs gno.land package related labelMar 17, 2025
@Ursulovic
Copy link
ContributorAuthor

Please also look into the txtar tests and add the Picker argument to the source there (to fix the CI).

Done in commit:42bad09

@Gno2D2Gno2D2 removed the review/triage-pendingPRs opened by external contributors that are waiting for the 1st review labelMar 18, 2025
@leohhhnleohhhn merged commit56078dd intognolang:masterMar 18, 2025
68 of 69 checks passed
}
})

t.Run("reversed ordering", func(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

why removing this test?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I was editing a lot of tests to call Picker properly, I probably accidentally deleted these. I apologize, I will return them very soon.

stefann-01 pushed a commit to stefann-01/gno that referenced this pull requestMar 19, 2025
…ng#3760)# Query Parameter Preservation in AVL PagerThis PR is necessary for the [Hall of Fame ImprovementPR](gnolang#3674) which adds sortingfunctionality to realms. Currently, when users navigate through pages,the sort parameter is lost because the pager doesn't preserve queryparameters. This enhancement ensures that sorting preferences (and otherquery parameters) persist during pagination.## GoalEnhance the current Pager implementation to preserve URL queryparameters when navigating between pages. The Picker function shouldmaintain all existing query parameters while only updating the pagenumber.## Changes1. Modify the `Picker` function signature to accept the current path:   ```go   func (p *Page) Picker(path string) string   ```2. Update the Picker implementation to:   - Parse query parameters from the provided path   - Generate pagination UI that preserves existing query parameters   - Maintain consistent link format across all pagination buttons## Implementation Details- Parse URL query parameters using `url.Parse`- Preserve all existing query parameters except `page`- Generate pagination links that include all preserved parameters- Handle edge cases (invalid paths, empty queries)## Development Checklist- [x] Update Pager implementation  - [x] Modify Picker function signature  - [x] Add query parameter parsing  - [x] Implement parameter preservation in link generation- [x] Update tests  - [x] Add tests for query parameter preservation  - [x] Test edge cases and invalid inputs- [x] Update dependent code  - [x] Modify all Picker function calls---------Co-authored-by: Ivan Ursulovic <ivan@Ivans-MacBook-Air.local>Co-authored-by: Ivan Ursulovic <ivan@MacBookAir.localdomain>Co-authored-by: Ivan Ursulovic <ivan@pop-os.localdomain>
moul pushed a commit that referenced this pull requestMar 20, 2025
### Restoring Missing TestsThis PR restores tests that were unintentionally removed while workingon [thisPR](#3760 (comment)). Itdoes not introduce any new features; it simply reinstates the missingtests in `gno.land/p/demo/avl/pager/pager_test.gno`.---------Co-authored-by: Ivan Ursulovic <ivan@Ivans-MacBook-Air.local>Co-authored-by: Ivan Ursulovic <ivan@MacBookAir.localdomain>Co-authored-by: Ivan Ursulovic <ivan@pop-os.localdomain>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@moulmoulmoul left review comments

@leohhhnleohhhnleohhhn approved these changes

Assignees

@UrsulovicUrsulovic

Labels
📦 ⛰️ gno.landIssues or PRs gno.land package related🧾 package/realmTag used for new Realms or Packages.
Projects
Status: Done
Status: Done
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@Ursulovic@Gno2D2@notJoon@leohhhn@moul

[8]ページ先頭

©2009-2025 Movatter.jp