-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Prefetch info panel data with config options prefetchObjects and prefetchStale
#2915
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
Conversation
|
I will reformat the title to use the proper commit message syntax. |
|
🚀 Thanks for opening this pull request! |
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThe changes introduce a prefetching and caching mechanism for cloud function results in the Parse Dashboard data browser. New configuration options, Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant BrowserTable
participant DataBrowser
participant CloudFunction
User->>BrowserTable: Selects a row (objectId)
BrowserTable->>DataBrowser: setSelectedObjectId(objectId)
DataBrowser->>DataBrowser: Update selectionHistory
alt Last 3 selections are consecutive
DataBrowser->>DataBrowser: Prefetch N next objects (prefetchObjects)
loop For each object to prefetch
DataBrowser->>CloudFunction: Call cloud function with objectId
CloudFunction-->>DataBrowser: Return result
DataBrowser->>DataBrowser: Cache result with timestamp
end
end
User->>BrowserTable: Requests cloud function result for objectId
BrowserTable->>DataBrowser: handleCallCloudFunction(objectId)
alt Cached result is valid (not stale)
DataBrowser->>BrowserTable: Return cached result
else
DataBrowser->>CloudFunction: Call cloud function
CloudFunction-->>DataBrowser: Return result
DataBrowser->>BrowserTable: Return result
end
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error code ERR_SSL_WRONG_VERSION_NUMBER 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
The label |
🎉 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: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
README.md(2 hunks)src/dashboard/Data/Browser/Browser.react.js(1 hunks)src/dashboard/Data/Browser/DataBrowser.react.js(7 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: mtrezza
PR: parse-community/parse-dashboard#2769
File: src/lib/ClassPreferences.js:26-26
Timestamp: 2025-05-02T11:55:52.809Z
Learning: Preference reads and writes in the ClassPreferences.js module are expected to be infrequent operations, so optimizing for performance (like caching) is unnecessary in this context.
src/dashboard/Data/Browser/Browser.react.js (1)
Learnt from: mtrezza
PR: parse-community/parse-dashboard#2769
File: src/lib/ClassPreferences.js:26-26
Timestamp: 2025-05-02T11:55:52.809Z
Learning: Preference reads and writes in the ClassPreferences.js module are expected to be infrequent operations, so optimizing for performance (like caching) is unnecessary in this context.
src/dashboard/Data/Browser/DataBrowser.react.js (3)
Learnt from: mtrezza
PR: parse-community/parse-dashboard#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.
Learnt from: mtrezza
PR: parse-community/parse-dashboard#0
File: :0-0
Timestamp: 2025-05-11T16:43:27.354Z
Learning: The bcryptjs library is used in Parse Dashboard for password encryption and validation in three files: Parse-Dashboard/Authentication.js (compareSync), Parse-Dashboard/CLI/mfa.js (genSaltSync, hashSync), and src/dashboard/Settings/DashboardSettings/DashboardSettings.react.js (genSaltSync, hashSync).
Learnt from: mtrezza
PR: parse-community/parse-dashboard#2769
File: src/lib/ClassPreferences.js:26-26
Timestamp: 2025-05-02T11:55:52.809Z
Learning: Preference reads and writes in the ClassPreferences.js module are expected to be infrequent operations, so optimizing for performance (like caching) is unnecessary in this context.
🪛 markdownlint-cli2 (0.17.2)
README.md
143-143: Table pipe style
Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
(MD055, table-pipe-style)
144-144: Table pipe style
Expected: leading_and_trailing; Actual: leading_only; Missing trailing pipe
(MD055, table-pipe-style)
⏰ 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 (8)
src/dashboard/Data/Browser/Browser.react.js (1)
464-465: LGTM! Good use of default values.The addition of
prefetchObjectsandprefetchStaleproperties with sensible defaults (0) is implemented correctly. This provides a clean way to propagate prefetch configuration from the panel settings.src/dashboard/Data/Browser/DataBrowser.react.js (6)
16-16: Import addition looks good.The Parse import is required for the new prefetching functionality.
110-111: State management is properly implemented.The new state properties
prefetchCacheandselectionHistoryare correctly initialized and reset when the class changes, preventing cross-class data contamination.Also applies to: 156-157
615-629: Selection history tracking is well implemented.The method correctly maintains a rolling window of the last 3 selections and triggers prefetching after state updates. Good handling of edge cases where the object might not be found.
649-682: Prefetch configuration and triggering logic looks good.The
getPrefetchSettingsmethod provides sensible defaults, andhandlePrefetchcorrectly detects sequential browsing patterns (3 consecutive selections) before triggering prefetches. Good optimization to avoid duplicate prefetches.
709-729: Cache management implementation is solid.The
handleCallCloudFunctionmethod properly checks cache validity, respects staleness settings, and cleans up stale entries. Good separation of concerns between cached and fresh data fetching.
833-833: Prop binding updated correctly.The
callCloudFunctionprop now correctly references the new handler that includes caching logic.README.md (1)
878-880: Example JSON looks good — no action neededThe new
prefetchObjectsandprefetchStaleproperties are correctly added and JSON syntax remains valid.
Nice touch including them in the sample config.
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: 1
🔭 Outside diff range comments (1)
src/dashboard/Data/Browser/DataBrowser.react.js (1)
522-542: Fix variable declaration scoping and redeclaration issuesThe static analysis correctly identifies both variable scoping issues and redeclaration of
newRowvariable.Apply this fix to properly scope the variables and avoid redeclaration:
case 40: // Down - standalone (move to the next row) // or with ctrl/meta (excel style - move to the last row) - prevObjectID = this.state.selectedObjectId; - const newRow = - e.ctrlKey || e.metaKey - ? this.props.data.length - 1 - : Math.min(this.state.current.row + 1, this.props.data.length - 1); - this.setState({ - current: { - row: newRow, - col: this.state.current.col, - }, - }); - - const newObjectIdDown = this.props.data[newRow].id; - this.setSelectedObjectId(newObjectIdDown); - this.setState({ showAggregatedData: true }); - if (prevObjectID !== newObjectIdDown && this.state.isPanelVisible) { - this.handleCallCloudFunction( - newObjectIdDown, - this.props.className, - this.props.app.applicationId - ); - } + { + const prevObjectID = this.state.selectedObjectId; + const newRowDown = + e.ctrlKey || e.metaKey + ? this.props.data.length - 1 + : Math.min(this.state.current.row + 1, this.props.data.length - 1); + this.setState({ + current: { + row: newRowDown, + col: this.state.current.col, + }, + }); + + const newObjectIdDown = this.props.data[newRowDown].id; + this.setSelectedObjectId(newObjectIdDown); + this.setState({ showAggregatedData: true }); + if (prevObjectID !== newObjectIdDown && this.state.isPanelVisible) { + this.handleCallCloudFunction( + newObjectIdDown, + this.props.className, + this.props.app.applicationId + ); + } + }
♻️ Duplicate comments (1)
src/dashboard/Data/Browser/DataBrowser.react.js (1)
684-707: Duplicate comment: Add error handling for prefetch failuresThe
prefetchObjectmethod should handle errors gracefully. If the cloud function fails, it could silently fail without any indication to the system.Consider adding error handling:
Parse.Cloud.run(cloudCodeFunction, params, options).then(result => { this.setState(prev => ({ prefetchCache: { ...prev.prefetchCache, [objectId]: { data: result, timestamp: Date.now() }, }, })); +}).catch(error => { + console.error(`Failed to prefetch object ${objectId}:`, error); + // Optionally, you could mark failed prefetches to avoid retrying });
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/dashboard/Data/Browser/DataBrowser.react.js(10 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: mtrezza
PR: parse-community/parse-dashboard#2769
File: src/lib/ClassPreferences.js:26-26
Timestamp: 2025-05-02T11:55:52.809Z
Learning: Preference reads and writes in the ClassPreferences.js module are expected to be infrequent operations, so optimizing for performance (like caching) is unnecessary in this context.
src/dashboard/Data/Browser/DataBrowser.react.js (3)
Learnt from: mtrezza
PR: parse-community/parse-dashboard#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.
Learnt from: mtrezza
PR: parse-community/parse-dashboard#0
File: :0-0
Timestamp: 2025-05-11T16:43:27.354Z
Learning: The bcryptjs library is used in Parse Dashboard for password encryption and validation in three files: Parse-Dashboard/Authentication.js (compareSync), Parse-Dashboard/CLI/mfa.js (genSaltSync, hashSync), and src/dashboard/Settings/DashboardSettings/DashboardSettings.react.js (genSaltSync, hashSync).
Learnt from: mtrezza
PR: parse-community/parse-dashboard#2769
File: src/lib/ClassPreferences.js:26-26
Timestamp: 2025-05-02T11:55:52.809Z
Learning: Preference reads and writes in the ClassPreferences.js module are expected to be infrequent operations, so optimizing for performance (like caching) is unnecessary in this context.
🪛 Biome (1.9.4)
src/dashboard/Data/Browser/DataBrowser.react.js
[error] 481-481: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 488-488: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 484-484: This variable is used before its declaration.
The variable is declared here:
(lint/correctness/noInvalidUseBeforeDeclaration)
[error] 488-488: This variable is used before its declaration.
The variable is declared here:
(lint/correctness/noInvalidUseBeforeDeclaration)
[error] 522-525: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 533-533: Other switch clauses can erroneously access this declaration.
Wrap the declaration in a block to restrict its access to the switch clause.
The declaration is defined in this switch clause:
Unsafe fix: Wrap the declaration in a block.
(lint/correctness/noSwitchDeclarations)
[error] 522-522: Shouldn't redeclare 'newRow'. Consider to delete it or rename it.
'newRow' is defined here:
(lint/suspicious/noRedeclare)
⏰ 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 (8)
src/dashboard/Data/Browser/DataBrowser.react.js (8)
110-111: LGTM: Cache and history state initializationThe addition of
prefetchCacheandselectionHistorystate variables properly initializes the prefetching mechanism with empty defaults.
156-157: LGTM: State reset on class changeCorrectly resets the prefetch cache and selection history when switching between classes to prevent stale data.
278-283: LGTM: Integration with panel toggleProperly integrates the new cloud function handler when toggling panel visibility.
615-629: LGTM: Enhanced selection tracking with prefetch triggeringThe updated
setSelectedObjectIdmethod correctly maintains selection history and triggers prefetching logic. The implementation properly handles index tracking and history length management.
649-658: LGTM: Configuration retrievalThe
getPrefetchSettingsmethod correctly extracts prefetch configuration from the props with appropriate fallback values.
660-682: LGTM: Sequential navigation detectionThe
handlePrefetchmethod implements robust logic to detect sequential navigation patterns and trigger prefetching accordingly. The consecutive index checking logic is sound.
709-729: LGTM: Cache-first cloud function handlingThe
handleCallCloudFunctionmethod implements an effective cache-first strategy with proper staleness checking and fallback to the original cloud function call. The cache cleanup logic for stale entries is appropriate.
833-833: LGTM: Proper prop integrationCorrectly passes the enhanced
handleCallCloudFunctionmethod to theBrowserTablecomponent, ensuring the caching and prefetching logic is applied throughout the browsing interface.
prefetchObjects and prefetchStale
prefetchObjects and prefetchStaleprefetchObjects and prefetchStale
# [7.3.0-alpha.20](7.3.0-alpha.19...7.3.0-alpha.20) (2025-07-17) ### Features * Prefetch info panel data with config options `prefetchObjects` and `prefetchStale` ([#2915](#2915)) ([54a8156](54a8156))
|
🎉 This change has been released in version 7.3.0-alpha.20 |
# [7.3.0](7.2.1...7.3.0) (2025-08-01) ### Bug Fixes * Changing "Relative dates" option of saved filter does not enable save button ([#2947](#2947)) ([4f4977d](4f4977d)) * Class object counters in sidebar not updating ([#2950](#2950)) ([0f1920b](0f1920b)) * Clicking linked pointer with Cmd key in view table doesn't open page in new browser tab ([#2902](#2902)) ([101b194](101b194)) * Fails to generate MFA code with CLI command `parse-dashboard --createMFA` ([#2883](#2883)) ([544df1f](544df1f)) * Gracefully fail when trying to get new features in latest version of dashboard ([#2880](#2880)) ([1969a0e](1969a0e)) * Header checkbox in data browser does not indicate when a few rows are selected ([#2957](#2957)) ([e4ab666](e4ab666)) * Hyperlink in Views table ignores `urlQuery` key ([#2926](#2926)) ([c5eedf4](c5eedf4)) * Incorrect table cell width in App Settings table ([#2933](#2933)) ([d46765b](d46765b)) * Info panel scroll-to-top setting not persistent across dashboard sessions ([#2938](#2938)) ([2b78087](2b78087)) * Invalid clipboard content for multi-cell copy in data browser ([#2882](#2882)) ([22a2065](22a2065)) * Legacy filters without `filterId` cannot be deleted in data browser ([#2946](#2946)) ([65df9d6](65df9d6)) * Legacy filters without `filterId` do not appear in sidebar ([#2945](#2945)) ([fde3769](fde3769)) * Modal text input can be resized smaller than its cell in Safari browser ([#2930](#2930)) ([82a0cdc](82a0cdc)) * Move settings button on data browser toolbar for better UI ([#2940](#2940)) ([c473ce6](c473ce6)) * Pagination footer bar hides rows in data browser ([#2879](#2879)) ([6bc2da8](6bc2da8)) * Race condition on info panel request shows info panel data not corresponding to selected cell ([#2909](#2909)) ([6f45bb3](6f45bb3)) * Saved legacy filter in data browser cannot be deleted or cloned ([#2944](#2944)) ([15da90d](15da90d)) * Saved legacy filter with classname in query cannot be deleted ([#2948](#2948)) ([05ee5b3](05ee5b3)) * Selected text in info panel cannot be copied using Ctrl+C ([#2951](#2951)) ([0164c19](0164c19)) * Views not sorted alphabetically in sidebar ([#2943](#2943)) ([4c81fe4](4c81fe4)) * Warning dialog is shown after executing script on selected rows ([#2899](#2899)) ([027f1ed](027f1ed)) ### Features * Add additional values in info panel key-value element ([#2904](#2904)) ([a8f110e](a8f110e)) * Add AI agent for natural language interaction with Parse Server ([#2954](#2954)) ([32bd6e8](32bd6e8)) * Add clipboard icon to copy value of key-value element in info panel ([#2871](#2871)) ([7862c42](7862c42)) * Add Cloud Function as data source for views with optional text or file upload ([#2939](#2939)) ([f5831c7](f5831c7)) * Add column freezing in data browser ([#2877](#2877)) ([29f4a88](29f4a88)) * Add custom data views with aggregation query ([#2888](#2888)) ([b1679db](b1679db)) * Add environment variable support for AI agent configuration ([#2956](#2956)) ([2ac9e7e](2ac9e7e)) * Add hyperlink support in Views table ([#2925](#2925)) ([06cfc11](06cfc11)) * Add inclusive date filters "is on or after", "is on or before" in data browser ([#2929](#2929)) ([c8d621b](c8d621b)) * Add quick-add button to array parameter in Cloud Config ([#2866](#2866)) ([e98ccb2](e98ccb2)) * Add row number column to data browser ([#2878](#2878)) ([c0aa407](c0aa407)) * Add Settings menu to scroll info panel to top when browsing through rows ([#2937](#2937)) ([f339cb8](f339cb8)) * Add support for "not equal to" filter for Boolean values in data browser and analytics explorer ([#2914](#2914)) ([d55b89c](d55b89c)) * Add support for `Image` type in View table to display images ([#2952](#2952)) ([6a6b1f0](6a6b1f0)) * Add type mismatch warning when quick-adding entry to Cloud Config array parameter ([#2875](#2875)) ([bb1837f](bb1837f)) * Add view edit icon to views list in sidebar ([#2901](#2901)) ([96e33b9](96e33b9)) * Allow editing filter without loading data in data browser ([#2949](#2949)) ([9623580](9623580)) * Allow editing saved filters in data browser ([#2942](#2942)) ([daaccaa](daaccaa)) * Allow freeform text view resizing in modal dialogs ([#2910](#2910)) ([1399162](1399162)) * Persist info panel visibility when navigating across classes in data browser ([#2908](#2908)) ([1a3610a](1a3610a)) * Prefetch info panel data with config options `prefetchObjects` and `prefetchStale` ([#2915](#2915)) ([54a8156](54a8156)) * Warn when leaving data browser page with selected rows ([#2887](#2887)) ([206ead1](206ead1)) ### Performance Improvements * Add config option `enableResourceCache` to cache dashboard resources locally for faster loading in additional browser tabs ([#2920](#2920)) ([41a4963](41a4963))
Summary
prefetchObjectsandprefetchStaleTesting
npm testhttps://chatgpt.com/codex/tasks/task_e_687894d40a6c832daffcfc644239bea4
Summary by CodeRabbit
New Features
Documentation
prefetchObjectsandprefetchStale).