diff --git a/src/components/BrowserCell/BrowserCell.react.js b/src/components/BrowserCell/BrowserCell.react.js
index 9a05c4c48c..19c5020082 100644
--- a/src/components/BrowserCell/BrowserCell.react.js
+++ b/src/components/BrowserCell/BrowserCell.react.js
@@ -400,7 +400,8 @@ export default class BrowserCell extends Component {
this.props.className,
this.props.objectId,
this.props.showNote,
- this.props.onRefresh
+ this.props.reloadDataTableAfterScript ? this.props.onRefresh : null,
+ this.props.reloadDataTableAfterScript ? null : this.props.onRefreshObjects
);
}
diff --git a/src/components/BrowserMenu/BrowserMenu.react.js b/src/components/BrowserMenu/BrowserMenu.react.js
index 5d97a9dd26..30ebd54cca 100644
--- a/src/components/BrowserMenu/BrowserMenu.react.js
+++ b/src/components/BrowserMenu/BrowserMenu.react.js
@@ -145,14 +145,12 @@ export default class BrowserMenu extends React.Component {
const estimatedSubmenuWidth = 150; // Estimate for edge detection
const openToLeft = parentRect.right + estimatedSubmenuWidth > window.innerWidth;
this.setState({ open: true, openToLeft });
- this.props.setCurrent?.(null);
// Notify parent that this submenu is now open (to close sibling submenus)
this.props.onSubmenuOpen?.(this.props.childKey);
};
} else {
entryEvents.onClick = () => {
this.setState({ open: true, openToLeft: false });
- this.props.setCurrent(null);
};
}
}
diff --git a/src/components/BrowserRow/BrowserRow.react.js b/src/components/BrowserRow/BrowserRow.react.js
index 5e443389f1..0ef142efde 100644
--- a/src/components/BrowserRow/BrowserRow.react.js
+++ b/src/components/BrowserRow/BrowserRow.react.js
@@ -185,6 +185,8 @@ export default class BrowserRow extends Component {
onEditSelectedRow={onEditSelectedRow}
showNote={this.props.showNote}
onRefresh={this.props.onRefresh}
+ onRefreshObjects={this.props.onRefreshObjects}
+ reloadDataTableAfterScript={this.props.reloadDataTableAfterScript}
scripts={this.props.scripts}
handleCellClick={this.props.handleCellClick}
selectedCells={this.props.selectedCells}
diff --git a/src/dashboard/Data/Browser/Browser.react.js b/src/dashboard/Data/Browser/Browser.react.js
index 505478f3ee..0daab4e259 100644
--- a/src/dashboard/Data/Browser/Browser.react.js
+++ b/src/dashboard/Data/Browser/Browser.react.js
@@ -185,6 +185,8 @@ class Browser extends DashboardView {
processedScripts: 0,
+ reloadDataTableAfterScript: window.localStorage?.getItem('reloadDataTableAfterScript') === 'true',
+
rowCheckboxDragging: false,
draggedRowSelection: false,
@@ -235,6 +237,8 @@ class Browser extends DashboardView {
this.showExecuteScriptRowsDialog = this.showExecuteScriptRowsDialog.bind(this);
this.confirmExecuteScriptRows = this.confirmExecuteScriptRows.bind(this);
this.cancelExecuteScriptRowsDialog = this.cancelExecuteScriptRowsDialog.bind(this);
+ this.refreshObjects = this.refreshObjects.bind(this);
+ this.toggleReloadDataTableAfterScript = this.toggleReloadDataTableAfterScript.bind(this);
this.confirmAttachSelectedRows = this.confirmAttachSelectedRows.bind(this);
this.cancelAttachSelectedRows = this.cancelAttachSelectedRows.bind(this);
this.showCloneSelectedRowsDialog = this.showCloneSelectedRowsDialog.bind(this);
@@ -1229,6 +1233,34 @@ class Browser extends DashboardView {
return true;
}
+ async refreshObjects(objectIds) {
+ const { useMasterKey } = this.state;
+ const className = this.props.params.className;
+ const query = new Parse.Query(className);
+ query.containedIn('objectId', objectIds);
+ this.excludeFields(query, className);
+ try {
+ const freshObjects = await query.find({ useMasterKey });
+ const freshMap = {};
+ freshObjects.forEach(obj => {
+ freshMap[obj.id] = obj;
+ });
+ this.setState(prevState => ({
+ data: prevState.data.map(obj => freshMap[obj.id] || obj),
+ }));
+ } catch (e) {
+ this.showNote(e.message, true);
+ }
+ }
+
+ toggleReloadDataTableAfterScript() {
+ this.setState(prevState => {
+ const newValue = !prevState.reloadDataTableAfterScript;
+ window.localStorage?.setItem('reloadDataTableAfterScript', newValue);
+ return { reloadDataTableAfterScript: newValue };
+ });
+ }
+
async fetchParseData(source, filters) {
if (this.currentQuery) {
this.currentQuery.cancel();
@@ -2196,10 +2228,18 @@ class Browser extends DashboardView {
totalErrorCount > 0
);
}
- this.setState(
- { selection: {}, showExecuteScriptRowsDialog: false },
- () => this.refresh()
- );
+ const objectIds = objects.map(obj => obj.id);
+ if (this.state.reloadDataTableAfterScript) {
+ this.setState(
+ { selection: {}, showExecuteScriptRowsDialog: false },
+ () => this.refresh()
+ );
+ } else {
+ this.setState(
+ { selection: {}, showExecuteScriptRowsDialog: false },
+ () => this.dataBrowserRef.current?.handleRefreshObjects(objectIds)
+ );
+ }
} catch (e) {
this.showNote(e.message, true);
console.log(`Could not run ${script.title}: ${e}`);
@@ -2815,6 +2855,9 @@ class Browser extends DashboardView {
onExport={this.showExport}
onChangeCLP={this.handleCLPChange}
onRefresh={this.refresh}
+ onRefreshObjects={this.refreshObjects}
+ reloadDataTableAfterScript={this.state.reloadDataTableAfterScript}
+ toggleReloadDataTableAfterScript={this.toggleReloadDataTableAfterScript}
onAttachRows={this.showAttachRowsDialog}
onAttachSelectedRows={this.showAttachSelectedRowsDialog}
onExecuteScriptRows={this.showExecuteScriptRowsDialog}
diff --git a/src/dashboard/Data/Browser/BrowserTable.react.js b/src/dashboard/Data/Browser/BrowserTable.react.js
index 79a509a2c8..548505ff52 100644
--- a/src/dashboard/Data/Browser/BrowserTable.react.js
+++ b/src/dashboard/Data/Browser/BrowserTable.react.js
@@ -198,6 +198,8 @@ export default class BrowserTable extends React.Component {
markRequiredFieldRow={this.props.markRequiredFieldRow}
showNote={this.props.showNote}
onRefresh={this.props.onRefresh}
+ onRefreshObjects={this.props.onRefreshObjects}
+ reloadDataTableAfterScript={this.props.reloadDataTableAfterScript}
scripts={this.context.scripts}
selectedCells={this.props.selectedCells}
handleCellClick={this.props.handleCellClick}
@@ -383,6 +385,8 @@ export default class BrowserTable extends React.Component {
onEditSelectedRow={this.props.onEditSelectedRow}
showNote={this.props.showNote}
onRefresh={this.props.onRefresh}
+ onRefreshObjects={this.props.onRefreshObjects}
+ reloadDataTableAfterScript={this.props.reloadDataTableAfterScript}
scripts={this.context.scripts}
selectedCells={this.props.selectedCells}
handleCellClick={this.props.handleCellClick}
diff --git a/src/dashboard/Data/Browser/BrowserToolbar.react.js b/src/dashboard/Data/Browser/BrowserToolbar.react.js
index 4513fb04ee..5498338b8c 100644
--- a/src/dashboard/Data/Browser/BrowserToolbar.react.js
+++ b/src/dashboard/Data/Browser/BrowserToolbar.react.js
@@ -105,6 +105,8 @@ const BrowserToolbar = ({
toggleGraphPanel,
isGraphPanelVisible,
runScriptShortcut,
+ reloadDataTableAfterScript,
+ toggleReloadDataTableAfterScript,
}) => {
const selectionLength = Object.keys(selection).length;
const isPendingEditCloneRows = editCloneRows && editCloneRows.length > 0;
@@ -626,6 +628,25 @@ const BrowserToolbar = ({
onClick={() => onExecuteScriptRows(selection)}
shortcut={runScriptShortcut}
/>
+
+