-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: View table data may be retained when switching between views #2996
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: View table data may be retained when switching between views #2996
Conversation
|
🚀 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. |
📝 WalkthroughWalkthroughOn 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
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
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) |
There was a problem hiding this 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
loadDatacorrectly addresses the issue of retained table data when switching views. React's setState batching ensures this clear is applied along with the subsequentloading: trueupdate fromloadData(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
loadDataruns 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
📒 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
# [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))
|
🎉 This change has been released in version 7.6.0-alpha.5 |
# [8.0.0](7.5.0...8.0.0) (2025-11-01) ### Bug Fixes * Add missing major version increase of dashboard release ([#3005](#3005)) ([5debb4d](5debb4d)) * Cannot connect to server with error invalid header name ([#3006](#3006)) ([ea4ec07](ea4ec07)) * Currently displayed view reloads when editing and saving a different view ([#3002](#3002)) ([794a35a](794a35a)) * Dashboard config objects stored on server with public read / write access ([#2997](#2997)) ([31a4639](31a4639)) * ESC key does not cancel editing in data browser cell ([#3001](#3001)) ([d1d7241](d1d7241)) * Filter text field in data browser partly looses focus when hitting enter key to apply filter ([#2992](#2992)) ([e3085b9](e3085b9)) * Filter text field in data browser partly looses focus when selecting in drop-down element by hitting enter key to apply filter ([#2993](#2993)) ([f4c17c7](f4c17c7)) * Info panel briefly shows cached media content from previously selected cell when using pre-fetch ([#3008](#3008)) ([dd6a85e](dd6a85e)) * Missing alert when changing data browser browser data while rows are selected ([#2994](#2994)) ([6cabaa3](6cabaa3)) * Security upgrade parse from 3.5.1 to 7.0.1 ([#3003](#3003)) ([5123fbf](5123fbf)) * Security upgrade passport from 0.5.3 to 0.6.0 ([#3000](#3000)) ([fbb5e6d](fbb5e6d)) * Session management issue that causes malformed redirect URLs ([#3011](#3011)) ([1649dd3](1649dd3)) * Storing view on server creates view key with hashed view name instead of UUID ([#2995](#2995)) ([7cb65f3](7cb65f3)) * Switching between browser tabs can cause illegible text color for config parameter value field ([#3010](#3010)) ([77c5c67](77c5c67)) * View table data may be retained when switching between views ([#2996](#2996)) ([ddc91c9](ddc91c9)) ### Features * Add `matches regex` filter to data browser replacing limited `string contains string` filter ([#2991](#2991)) ([64a9f71](64a9f71)) * Add info panel options `prefetchImage`, `prefetchVideo`, `prefetchAudio` to pre-fetch media content in the info panel ([#3009](#3009)) ([6796c9e](6796c9e)) * Add Parse Server version compatibility detection ([#3004](#3004)) ([9a7a60f](9a7a60f)) ### Performance Improvements * Storing, deleting, modifying view in server storage now only affects the specific view instead of updating all views ([#2998](#2998)) ([48cea3c](48cea3c)) ### BREAKING CHANGES * This increases the required minimum version to Parse Server 7. ([5debb4d](5debb4d))
|
🎉 This change has been released in version 8.0.0 |
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