Skip to content

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Dec 28, 2025

New Pull Request Checklist

Issue Description

Data browser pagination is not reflected in the dashboard URL, hence when using browser navigation to go backwards, forwards the pagination information is lost.

Approach

Add pagination to browser URL, so that pagination information is preserved when using browser navigation. This also adds the benefit that pagination is now controllable through dashboard URL; for example it's now possible to jump to a specific page via the dashboard URL.

Summary by CodeRabbit

  • New Features
    • Added URL-driven pagination: page position (skip/limit) now persists in the URL, allowing users to bookmark and share paginated views.
    • Pagination state is synchronized with browser navigation: back/forward buttons now correctly restore pagination positions.
    • Pagination resets to the first page when filters change, with URL updates reflecting the change.

✏️ Tip: You can customize this high-level summary in your review settings.

@parse-github-assistant
Copy link

parse-github-assistant bot commented Dec 28, 2025

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

@coderabbitai
Copy link

coderabbitai bot commented Dec 28, 2025

📝 Walkthrough

Walkthrough

This PR adds URL-driven pagination support to the Browser component. It introduces utilities to extract pagination parameters from query strings and update URLs while preserving filter state. Data fetching and navigation flows are adjusted to read and propagate pagination parameters.

Changes

Cohort / File(s) Summary
URL-driven pagination in Browser component
src/dashboard/Data/Browser/Browser.react.js
Added extractPaginationFromQuery() method to read skip/limit from query parameters; introduced updateURL() method to build and push URLs with preserved filters and pagination; integrated pagination extraction into initial state and prefetchData flow; updated BrowserFooter interactions to trigger URL updates when pagination changes; bound updateURL in constructor.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant Browser as Browser Component
    participant URL as App Router/URL
    participant DataFetch as Data Fetch
    
    User->>Browser: Interact with pagination (next/prev page)
    Browser->>Browser: updateURL(newSkip, newLimit)<br/>Preserve current filters
    Browser->>URL: Push new URL<br/>(skip, limit, filters)
    Browser->>Browser: prefetchData() triggered<br/>via componentDidMount/update
    Browser->>Browser: extractPaginationFromQuery()<br/>Read skip/limit from URL
    Browser->>DataFetch: Fetch data with new skip/limit
    DataFetch-->>Browser: Return paginated data
    Browser->>Browser: Update state & render<br/>with new page
    Browser-->>User: Display new page
    
    User->>Browser: Change filter/class
    Browser->>Browser: updateURL(skip=0, currentLimit)<br/>Reset to first page
    Browser->>URL: Push new URL<br/>(skip=0, filters changed)
    Browser->>DataFetch: Fetch fresh data
    DataFetch-->>Browser: Return data for new filter
    Browser-->>User: Display results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: fixing pagination being ignored during browser navigation or page reload, which aligns with the actual changes to add URL-driven pagination support.
Description check ✅ Passed The description follows the template with all critical sections filled: checklist items marked, issue clearly stated, and approach well-documented. Only non-critical TODOs section is incomplete, which is acceptable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@parseplatformorg
Copy link
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@mtrezza mtrezza changed the title fix: Data browser pagination is ignored when using browser navigation or page reload fix: Data browser pagination is lost when using browser navigation or page reload Dec 28, 2025
@mtrezza mtrezza changed the title fix: Data browser pagination is lost when using browser navigation or page reload fix: Data browser pagination is ignored when using browser navigation or page reload Dec 28, 2025
@mtrezza mtrezza merged commit bcc4d5f into parse-community:alpha Dec 28, 2025
11 of 12 checks passed
parseplatformorg pushed a commit that referenced this pull request Dec 28, 2025
# [8.2.0-alpha.15](8.2.0-alpha.14...8.2.0-alpha.15) (2025-12-28)

### Bug Fixes

*  Data browser pagination is ignored when using browser navigation or page reload ([#3097](#3097)) ([bcc4d5f](bcc4d5f))
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/dashboard/Data/Browser/Browser.react.js (1)

2728-2746: Potential double data fetch when pagination changes.

The current implementation triggers two data fetches when pagination changes:

  1. updateOrdering(this.state.ordering) fetches data immediately (Line 2733, 2741)
  2. updateURL() calls navigate(), which triggers componentWillReceivePropsprefetchData → another data fetch

Both fetches use the same parameters and retrieve identical data, making the second fetch redundant. This wastes resources and could cause race conditions or UI flickering if the responses arrive in an unexpected order.

Suggested approach: Remove the updateOrdering call and rely solely on the navigation flow. The immediate setState provides UI responsiveness, while prefetchData (triggered by URL change) handles the data fetch:

🔎 Proposed refactor
 setSkip={skip => {
   this.setState({ skip }, () => {
     this.updateURL(skip, null);
-    this.updateOrdering(this.state.ordering);
   });
 }}
 setLimit={limit => {
   this.setState({ limit, skip: 0 }, () => {
     this.updateURL(0, limit);
-    this.updateOrdering(this.state.ordering);
   });
 }}

If immediate data fetching is required for UX (to avoid waiting for async navigation), consider adding a flag to prevent the second fetch when URL changes are triggered programmatically.

🧹 Nitpick comments (2)
src/dashboard/Data/Browser/Browser.react.js (2)

1423-1426: Consider removing redundant state update.

The setState({ skip: 0 }) after navigation is redundant. The navigate call triggers componentWillReceiveProps, which calls prefetchData, which reads skip from the URL (defaulting to 0) and updates state accordingly.

🔎 Proposed refactor
   // filters param change is making the fetch call
   this.props.navigate(generatePath(this.context, url));
 }
-
-this.setState({
-  skip: 0,
-});

1399-1421: Consider refactoring URL building logic to reduce duplication.

The URL construction logic here is similar to updateURL (lines 659-696). If the URL building logic changes (e.g., adding new parameters to preserve), these two locations would need to be updated separately, risking inconsistency.

Consider extracting the URL building logic into a shared helper method or using updateURL directly where feasible.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 186ca40 and 7352792.

📒 Files selected for processing (1)
  • src/dashboard/Data/Browser/Browser.react.js
🧰 Additional context used
🧬 Code graph analysis (1)
src/dashboard/Data/Browser/Browser.react.js (1)
src/lib/generatePath.js (2)
  • generatePath (3-34)
  • filters (8-8)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Node 18
  • GitHub Check: Docker linux/amd64
🔇 Additional comments (4)
src/dashboard/Data/Browser/Browser.react.js (4)

206-206: LGTM!

The method binding follows the standard React pattern and is consistent with other bindings in the constructor.


638-657: LGTM!

The pagination extraction logic is well-implemented with proper validation:

  • Safely handles missing or invalid query parameters
  • Uses parseInt with radix 10 (good practice)
  • Validates skip >= 0 and limit > 0
  • Returns sensible defaults

659-696: LGTM!

The updateURL method is well-designed:

  • Preserves existing query parameters (filters, filterId, editFilter)
  • Optimizes URLs by excluding default values (skip=0, limit=100)
  • Uses navigate to enable browser back/forward functionality
  • Correctly handles relation URLs by returning early

551-594: LGTM!

The pagination integration into prefetchData is well-implemented:

  • Extracts pagination parameters from the URL query string
  • Provides sensible fallback to current state when URL parameters are absent
  • Makes the URL the source of truth for pagination state

@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 8.2.0-alpha.15

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Dec 28, 2025
@mtrezza mtrezza deleted the feat/pagination-browser-url branch December 28, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants