Skip to content

Conversation

mtrezza
Copy link
Member

@mtrezza mtrezza commented Oct 5, 2025

New Pull Request Checklist

Issue Description

View table data may be retained when switching between views. This means, when switching to a different view, the table data may contain entries from the previous view table data.

Approach

Clear table data on switch.

Summary by CodeRabbit

  • Bug Fixes
    • Eliminates stale table content when switching views by immediately clearing previous data before loading new results.
    • Preserves and enforces scroll-to-top behavior on every view change for consistent navigation.
    • Reduces visual flicker and confusion by showing an empty state promptly while new data loads.
    • Improves perceived responsiveness and reliability when navigating between views.
    • Enhances overall stability of the dashboard’s table rendering during rapid view changes.

Copy link

parse-github-assistant bot commented Oct 5, 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.

Copy link

coderabbitai bot commented Oct 5, 2025

📝 Walkthrough

Walkthrough

On view changes, the React component now immediately resets its table-related state (data, order, columns, tableWidth) before invoking loadData for the new view, while preserving the existing scroll-to-top behavior.

Changes

Cohort / File(s) Summary
View switch reset
src/dashboard/Data/Views/Views.react.js
Adds immediate state reset (data=[], order=[], columns={}, tableWidth=0) upon view change before calling loadData; retains scroll-to-top.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant ViewsComponent as Views.react.js
  participant DataService as loadData(...)

  User->>ViewsComponent: Change view (name/context)
  activate ViewsComponent
  Note right of ViewsComponent: Existing: window scroll to top
  ViewsComponent->>ViewsComponent: Reset state {data:[], order:[], columns:{}, tableWidth:0}
  ViewsComponent->>DataService: loadData(nextProps.params.name)
  DataService-->>ViewsComponent: New data response
  ViewsComponent->>ViewsComponent: Render with new data
  deactivate ViewsComponent
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The pull request description follows the template structure but omits the required “Closes:” line under the Issue Description and does not include the TODOs before merging section for tests and documentation updates, leaving key template items unfilled. Please add the “Closes: #issue_number” reference under Issue Description and include a TODOs section listing pending tasks such as adding tests and documentation changes to fully satisfy the repository’s template requirements.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly describes the bug being fixed—view table data retention when switching views—and directly reflects the primary change in the code, making it concise and relevant for a teammate scanning the history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ 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.

security/snyk check is complete. No issues have been found. (View Details)

@mtrezza mtrezza merged commit ddc91c9 into parse-community:alpha Oct 5, 2025
10 of 11 checks passed
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/Views/Views.react.js (1)

84-85: LGTM! State clearing prevents stale data visibility.

The immediate state reset before loadData correctly addresses the issue of retained table data when switching views. React's setState batching ensures this clear is applied along with the subsequent loading: true update from loadData (line 153), preventing any visible flash of old data.

Optional refinement (not required): If you prefer explicit ordering, you could use setState's callback to ensure loadData runs after the state is cleared:

-      // Clear table state immediately when switching views to prevent data retention
-      this.setState({ data: [], order: [], columns: {}, tableWidth: 0 });
-      this.loadData(nextProps.params.name);
+      // Clear table state immediately when switching views to prevent data retention
+      this.setState({ data: [], order: [], columns: {}, tableWidth: 0 }, () => {
+        this.loadData(nextProps.params.name);
+      });

However, React's setState batching already handles this correctly, so the current approach is fine.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d46ee44 and 76313a7.

📒 Files selected for processing (1)
  • src/dashboard/Data/Views/Views.react.js (1 hunks)
⏰ 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

parseplatformorg pushed a commit that referenced this pull request Oct 5, 2025
# [7.6.0-alpha.5](7.6.0-alpha.4...7.6.0-alpha.5) (2025-10-05)

### Bug Fixes

* View table data may be retained when switching between views ([#2996](#2996)) ([ddc91c9](ddc91c9))
@parseplatformorg
Copy link
Contributor

🎉 This change has been released in version 7.6.0-alpha.5

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Oct 5, 2025
@mtrezza mtrezza deleted the fix/view-table-data-retained branch October 5, 2025 11:59
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