Skip to content

Conversation

@mtrezza
Copy link
Member

@mtrezza mtrezza commented Nov 28, 2025

New Pull Request Checklist

Issue Description

Info panel data not reloading when clicking refresh button in data browser.

Approach

Reload info panel data on data browser reload.

Summary by CodeRabbit

  • New Features

    • Multi-panel refresh propagates to visible panels and toolbar/table components, selectively reloading visible objects and clearing stale prefetch caches.
  • Improvements

    • Refresh now returns a boolean completion status so callers can react to cancel/success.
    • Refresh flow ensures panels reset loading state on cancel and triggers targeted data reloads for active panels.

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

@parse-github-assistant
Copy link

parse-github-assistant bot commented Nov 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 Nov 28, 2025

📝 Walkthrough

Walkthrough

Browser.refresh() was changed to return a boolean indicating completion (false on user-cancel), and to trigger fetches without awaiting in non-relational paths. DataBrowser adds a bound async handleRefresh, wired to child components, which awaits onRefresh result, clears prefetchCache entries for affected objects, and triggers per-panel/multi-panel re-fetch and cloud-function calls.

Changes

Cohort / File(s) Summary
Browser core refresh
src/dashboard/Data/Browser/Browser.react.js
refresh() now returns a boolean (returns false when a selection-confirm dialog is cancelled, true on completion). Adjusted control flow to call fetchData (non-relational) without awaiting and preserve prior setRelation behavior.
DataBrowser refresh wiring
src/dashboard/Data/Browser/DataBrowser.react.js
Added this.handleRefresh = this.handleRefresh.bind(this); and new async handleRefresh() method. handleRefresh awaits this.props.onRefresh(), clears prefetchCache entries for selected/visible multi-panel objects, and triggers object re-fetchs via handleCallCloudFunction and fetchDataForMultiPanel. Propagated handler to children via onRefresh={this.handleRefresh}.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User
participant DataBrowser
participant Browser
participant PrefetchCache
participant CloudFunction
participant MultiPanelFetcher

User->>DataBrowser: Click Refresh (Toolbar/Table)
DataBrowser->>DataBrowser: handleRefresh()
DataBrowser->>Browser: props.onRefresh()
Browser-->>DataBrowser: true / false (boolean result)
alt canceled (false)
    DataBrowser-->>User: no further action
else proceed (true)
    DataBrowser->>PrefetchCache: clear selected object's key
    DataBrowser->>CloudFunction: handleCallCloudFunction(selectedObjectId)
    CloudFunction-->>DataBrowser: object data
    opt multi-panel visible
        DataBrowser->>PrefetchCache: clear other visible object keys
        DataBrowser->>MultiPanelFetcher: fetchDataForMultiPanel(objectId...)
        MultiPanelFetcher-->>DataBrowser: panel data
    end
    DataBrowser->>Browser: trigger UI updates / fetchData calls
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify callers handle the new boolean return from Browser.refresh() and that cancellation paths return false consistently.
  • Confirm handleRefresh() correctly clears prefetchCache keys only for intended object IDs and doesn’t race with ongoing prefetches.
  • Inspect integration between handleCallCloudFunction, fetchDataForMultiPanel, and UI update paths for ordering and error handling.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main issue being fixed: info panel data not reloading on refresh button click in the data browser.
Description check ✅ Passed The PR description completes the essential template sections (checklist items, issue description, and approach) but omits the TODOs section and does not specify which issue it references.
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

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7c7aa3a and e3371f3.

📒 Files selected for processing (2)
  • src/dashboard/Data/Browser/Browser.react.js (2 hunks)
  • src/dashboard/Data/Browser/DataBrowser.react.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/dashboard/Data/Browser/DataBrowser.react.js
  • src/dashboard/Data/Browser/Browser.react.js

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

parseplatformorg commented Nov 28, 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.

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: 1

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)

1040-1066: Return value doesn't reflect actual completion status.

The method returns true immediately after calling fetchData without awaiting it (line 1063). This means the caller receives true before the data refresh actually completes, which is misleading.

Impact on DataBrowser.handleRefresh:

  • DataBrowser.handleRefresh() (line 378 in DataBrowser.react.js) awaits this method and uses the return value to determine whether to refresh panel data
  • If true is returned before data fetch completes, there could be race conditions where panel refresh logic executes while the main data is still loading

Consider one of these approaches:

Option 1: Await fetchData to reflect actual completion (Recommended)

    } else {
      this.setState({
        ...initialState,
        relation: null,
      });
-     this.fetchData(this.props.params.className, prevFilters);
+     await this.fetchData(this.props.params.className, prevFilters);
    }
    return true;

Option 2: Document the return semantics

If the current behavior is intentional (returning before completion), add a JSDoc comment:

+ /**
+  * Initiates a refresh of the browser data.
+  * @returns {Promise<boolean>} true if refresh was initiated (not completed), false if cancelled by user
+  */
  async refresh() {

Note: The relational path (line 1057) has the same issue—setRelation triggers async fetchRelation internally but isn't awaited either.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e4811f and f0facfc.

📒 Files selected for processing (2)
  • src/dashboard/Data/Browser/Browser.react.js (2 hunks)
  • src/dashboard/Data/Browser/DataBrowser.react.js (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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/Browser.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). (3)
  • GitHub Check: Node 22
  • GitHub Check: Node 18
  • GitHub Check: Docker linux/amd64

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/Browser.react.js (1)

1041-1076: Well-structured async refactor with proper error handling.

The implementation correctly:

  • Invokes the callback before resetting state, allowing the caller to set loading indicators
  • Uses try/catch to handle errors gracefully
  • Returns a boolean to indicate success/failure for caller coordination

One minor consideration: The empty catch block at line 1073 swallows the error silently. While the caller handles failures via the return value, logging the error here could aid debugging.

-    } catch {
+    } catch (error) {
+      console.error('Refresh failed:', error);
       return false;
     }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0facfc and 7c7aa3a.

📒 Files selected for processing (2)
  • src/dashboard/Data/Browser/Browser.react.js (4 hunks)
  • src/dashboard/Data/Browser/DataBrowser.react.js (8 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 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/Browser.react.js
📚 Learning: 2025-05-27T12:09:47.644Z
Learnt from: mtrezza
Repo: parse-community/parse-dashboard PR: 2828
File: src/dashboard/Data/Browser/Browser.react.js:1605-1607
Timestamp: 2025-05-27T12:09:47.644Z
Learning: In script execution dialogs in Parse Dashboard (specifically the `confirmExecuteScriptRows` method in `src/dashboard/Data/Browser/Browser.react.js`), individual `setState` calls to update `processedScripts` counter should be kept as-is rather than batched, because this provides real-time progress feedback to users in the dialog UI.

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 (9)
src/dashboard/Data/Browser/Browser.react.js (2)

414-414: LGTM: Returning the promise enables proper async coordination.

This change allows callers to await or chain the cloud function call, which is essential for the new refresh workflow.


1522-1522: LGTM: Returning the promise enables awaiting relation setup.

This aligns with the async refresh workflow, allowing the caller to wait for the relation data to be fully fetched.

src/dashboard/Data/Browser/DataBrowser.react.js (7)

146-146: LGTM: Constructor binding for handleRefresh.


377-424: Improved implementation with batched state updates.

The refactored approach correctly:

  • Batches all cache deletions into a single setState call (addressing the previous concern about multiple re-renders)
  • Uses the promisified setState pattern to ensure cache is cleared before fetches begin
  • Collects all fetch promises and awaits them with Promise.all

Note: fetchDataForMultiPanel swallows its errors internally (line 1126-1132), so individual panel fetch failures won't cause Promise.all to reject. This is likely intentional to prevent one panel's failure from blocking others. However, handleCallCloudFunction can still reject, which will be caught by handleRefresh's try/catch.


426-439: Clean helper method for setting loading states.

The method appropriately sets loading indicators for both the main panel and all currently displayed multi-panel objects.


441-464: Comprehensive error handling addresses previous review feedback.

This implementation properly:

  • Wraps the entire refresh flow in try/catch
  • Passes a loading callback to ensure UI feedback before data reset
  • Resets loading states on both explicit failure (success === false) and caught exceptions
  • Logs errors and optionally displays user notification

This addresses the concerns raised in the previous review about error handling.


1086-1134: LGTM: Consistent promise returns enable async coordination.

All code paths now return promises, which allows refreshPanels() to properly await all panel data fetches with Promise.all.


1401-1411: LGTM: Promise returns enable proper refresh coordination.

Both the cached and non-cached paths now return promises, allowing the refresh workflow to properly await data loading.


1692-1692: LGTM: Correctly wires handleRefresh to toolbar.

The refresh button in the toolbar will now trigger the coordinated refresh flow that handles both data and panel refresh.

@mtrezza mtrezza merged commit 8f91d15 into parse-community:alpha Nov 28, 2025
11 checks passed
parseplatformorg pushed a commit that referenced this pull request Nov 28, 2025
# [8.1.0-alpha.7](8.1.0-alpha.6...8.1.0-alpha.7) (2025-11-28)

### Bug Fixes

* Info panel data not reloading when clicking refresh button in data browser ([#3027](#3027)) ([8f91d15](8f91d15))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 8.1.0-alpha.7

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Nov 28, 2025
@mtrezza mtrezza deleted the fix/panel-refresh branch November 28, 2025 02:20
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