Skip to content

fix: Prefetch for multiple info panels in data browser doesn't refresh stale cached data#3080

Merged
mtrezza merged 3 commits intoparse-community:alphafrom
mtrezza:fix/batch-nav-prefetch
Dec 16, 2025
Merged

fix: Prefetch for multiple info panels in data browser doesn't refresh stale cached data#3080
mtrezza merged 3 commits intoparse-community:alphafrom
mtrezza:fix/batch-nav-prefetch

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Dec 16, 2025

New Pull Request Checklist

Summary by CodeRabbit

  • Performance Improvements
    • Enhanced batch navigation to rebuild object displays starting from selected items for faster updates
    • Implemented intelligent cache maintenance with timestamp-based cleanup
    • Optimized prefetch logic to reduce redundant data requests and improve responsiveness

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

@parse-github-assistant
Copy link

parse-github-assistant bot commented Dec 16, 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.

@parseplatformorg
Copy link
Contributor

parseplatformorg commented Dec 16, 2025

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.

@coderabbitai
Copy link

coderabbitai bot commented Dec 16, 2025

📝 Walkthrough

Walkthrough

The PR enhances DataBrowser's batch navigation and prefetch caching logic. It adds timestamp-based cache maintenance to clean stale prefetch entries, introduces a needsPrefetch() helper to determine prefetch needs, and refactors the prefetch and batch display rebuild logic to validate cache validity before fetching.

Changes

Cohort / File(s) Summary
Batch Navigation & Prefetch Logic
src/dashboard/Data/Browser/DataBrowser.react.js
Enhanced batch display rebuild when selectedObjectId changes (now rebuilds when object not in batch or batch navigation enabled); added timestamp-based prefetch cache cleanup via Date.now(); introduced needsPrefetch() helper to determine if objects need prefetching based on cache presence or staleness; refactored prefetch flow to use needsPrefetch() in both single-panel and multi-panel scenarios; expanded handlePrefetch to validate cache before fetching main and batch-related objects.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Complexity drivers:

    • Dense logic changes affecting multiple code paths (batch rebuild, prefetch decision points, cache cleanup)
    • Interrelated concerns requiring understanding of batch navigation state, multi-panel display, and prefetch caching mechanics
    • Timestamp-based cache validation logic requires careful verification of staleness conditions
    • Two distinct prefetch paths (single-panel and multi-panel) with similar but separate logic
  • Areas requiring extra attention:

    • needsPrefetch() helper logic and its application across different prefetch scenarios
    • Timestamp-based cache cleanup logic (when/how stale entries are removed)
    • Interaction between batch rebuild conditions and prefetch decisions
    • Multi-panel prefetch flow logic and batch teammate prefetch handling

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete. Only checklist items are marked, but critical sections like 'Issue Description', 'Approach', and 'TODOs before merging' are missing. Add the 'Issue Description' section referencing the specific issue number, describe the approach taken, and specify any remaining TODOs before merge.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing prefetch behavior for multiple info panels to refresh stale cached data during batch navigation.
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.

@mtrezza mtrezza changed the title perf: Optimize prefetching for multiple info panels when batch-navigating in data browser fix: Prefetching for multiple info panels in data browser doesn't refresh stale cached data Dec 16, 2025
@mtrezza mtrezza changed the title fix: Prefetching for multiple info panels in data browser doesn't refresh stale cached data fix: Prefetch for multiple info panels in data browser doesn't refresh stale cached data Dec 16, 2025
@mtrezza mtrezza merged commit e71d4e6 into parse-community:alpha Dec 16, 2025
1 of 2 checks passed
@mtrezza mtrezza deleted the fix/batch-nav-prefetch branch December 16, 2025 13:23
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

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

1387-1397: Consider simplifying needsPrefetch since stale entries are pre-cleaned.

The helper function is a good abstraction. However, since stale entries are already deleted in the cleanup loop above (lines 1376-1381), the stale check inside needsPrefetch (lines 1392-1395) will never evaluate to true—the stale entries no longer exist in cache by the time this helper is called.

This is defensively correct but slightly redundant. You could simplify to just check cache membership, or keep it as-is for future-proofing if the cleanup logic ever changes.

     const needsPrefetch = (objectId) => {
-      if (!Object.prototype.hasOwnProperty.call(cache, objectId)) {
-        return true;
-      }
-      if (prefetchStale) {
-        const entry = cache[objectId];
-        return entry && (now - entry.timestamp) / 1000 >= prefetchStale;
-      }
-      return false;
+      return !Object.prototype.hasOwnProperty.call(cache, objectId);
     };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f335b2 and 91b6d81.

📒 Files selected for processing (1)
  • src/dashboard/Data/Browser/DataBrowser.react.js (5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-12-13T19:47:18.023Z
Learnt from: mtrezza
Repo: parse-community/parse-dashboard PR: 0
File: :0-0
Timestamp: 2025-12-13T19:47:18.023Z
Learning: In Parse Dashboard DataBrowser, the panel header context menu uses the hardcoded 'objectId' field when filtering scripts via `getValidScripts` because the panel header represents the entire object, not a specific field. Field-specific script execution happens when right-clicking on individual table cells in BrowserCell.

Applied to files:

  • src/dashboard/Data/Browser/DataBrowser.react.js
📚 Learning: 2025-07-31T06:12:17.707Z
Learnt from: mtrezza
Repo: parse-community/parse-dashboard PR: 2957
File: src/dashboard/Data/Browser/BrowserTable.react.js:584-597
Timestamp: 2025-07-31T06:12:17.707Z
Learning: In Parse Dashboard's data browser selection logic (src/dashboard/Data/Browser/BrowserTable.react.js), the `selection['*']` pattern is used to handle global operations that pass `{ '*': true }` to indicate all items are selected, particularly for bulk operations like delete. This is not dead code but serves as compatibility layer for global operations that don't go through normal individual row selection workflows.

Applied to files:

  • src/dashboard/Data/Browser/DataBrowser.react.js
⏰ 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). (1)
  • GitHub Check: Docker linux/amd64
🔇 Additional comments (3)
src/dashboard/Data/Browser/DataBrowser.react.js (3)

960-964: LGTM! Clear optimization for batch navigation prefetch utilization.

The condition change ensures the batch is always rebuilt when batchNavigate is enabled, positioning the selected object at the start of the batch. This aligns with the navigation step size (jumping by panelCount) and enables proper utilization of prefetched data for subsequent batches.


1421-1423: Clean refactoring using the helper function.

Good use of the needsPrefetch helper to make the prefetch decision more readable and consistent with the batch object check below.


1430-1432: Consistent use of the helper for batch object prefetch decisions.

parseplatformorg pushed a commit that referenced this pull request Dec 16, 2025
# [8.2.0-alpha.9](8.2.0-alpha.8...8.2.0-alpha.9) (2025-12-16)

### Bug Fixes

* Prefetch for multiple info panels in data browser doesn't refresh stale cached data ([#3080](#3080)) ([e71d4e6](e71d4e6))
@parseplatformorg
Copy link
Contributor

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

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Dec 16, 2025
parseplatformorg pushed a commit that referenced this pull request Jan 15, 2026
# [8.2.0](8.1.0...8.2.0) (2026-01-15)

### Bug Fixes

*  Data browser pagination is ignored when using browser navigation or page reload ([#3097](#3097)) ([bcc4d5f](bcc4d5f))
* Batch-navigation is active even if info panels are not visible ([#3053](#3053)) ([91b544a](91b544a))
* Calculated value drop-down in menu bar overlaps with info panel buttons ([#3116](#3116)) ([0f6f729](0f6f729))
* Context menu in data browser disappears behind menu bar ([#3106](#3106)) ([2c6c471](2c6c471))
* Data browser table headers misaligned when scrolling horizontally ([#3067](#3067)) ([f495dd1](f495dd1))
* Graph panel covers right-most columns of data browser table ([#3112](#3112)) ([00b0d70](00b0d70))
* Graph panel shows date tick labels on x-axis in local time instead of UTC ([#3111](#3111)) ([85d4946](85d4946))
* Header row in View table disappears when scrolling up ([#3105](#3105)) ([2923e86](2923e86))
* Info panel covers whole sidebar if fewer objects than panels in multi-panel scenario ([#3042](#3042)) ([dd3ba8d](dd3ba8d))
* Info panel not refreshing on script execution ([#3040](#3040)) ([f57e7e2](f57e7e2))
* Prefetch for multiple info panels in data browser doesn't refresh stale cached data ([#3080](#3080)) ([e71d4e6](e71d4e6))
* Right-click on info panel header selects the object ([#3082](#3082)) ([ae87114](ae87114))
* Saved filter is not recognized in data browser filter dialog ([#3108](#3108)) ([8a4ce15](8a4ce15))
* Some context menu sub-menu lists don't change background color on mouse hover in Safari browser ([#3109](#3109)) ([6269d18](6269d18))

### Features

* Add AI agent browser control for autonomous development ([#3114](#3114)) ([5940455](5940455))
* Add confirmation dialog to handle conflicts when migrating settings to server ([#3092](#3092)) ([ae50b8d](ae50b8d))
* Add getting related records to context menu of info panel header ([#3083](#3083)) ([2623802](2623802))
* Add graph panel for data visualization ([#3110](#3110)) ([1e15e27](1e15e27))
* Add keyboard shortcuts for quick actions in data browser ([#3073](#3073)) ([858d0cc](858d0cc))
* Add Node 24 support ([#3041](#3041)) ([8cf2735](8cf2735))
* Add storing data browser filters on server ([#3090](#3090)) ([b991734](b991734))
* Add storing data browser graphs to support multiple graphs per class ([#3113](#3113)) ([e76f605](e76f605))
* Add support for `Video` type in View table to display videos ([#3061](#3061)) ([bd4aa4f](bd4aa4f))
* Allow selecting objects by click-dragging over info panel headers ([#3074](#3074)) ([d6ef86c](d6ef86c))
* Auto-expand filter list when clicking on class in data browser ([#3101](#3101)) ([30a733c](30a733c))
* Execute scripts via right-click on info panel header column ([#3068](#3068)) ([2983741](2983741))

### Performance Improvements

* Add local caching for server-stored settings to reduce loading from server ([#3094](#3094)) ([409973a](409973a))
* Remove unnecessary data fetches from data browser pagination ([#3098](#3098)) ([bc59998](bc59998))
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