Skip to content

Commit 794a35a

Browse files
authored
fix: Currently displayed view reloads when editing and saving a different view (#3002)
1 parent a3c6a83 commit 794a35a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/dashboard/Data/Views/Views.react.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Views extends TableView {
8787
}
8888
}
8989

90-
async loadViews(app) {
90+
async loadViews(app, skipDataReload = false) {
9191
// Initialize ViewPreferencesManager if not already done or if app changed
9292
if (!this.viewPreferencesManager || this.viewPreferencesManager.app !== app) {
9393
this.viewPreferencesManager = new ViewPreferencesManager(app);
@@ -132,7 +132,7 @@ class Views extends TableView {
132132
}
133133
}
134134
});
135-
if (this._isMounted) {
135+
if (this._isMounted && !skipDataReload) {
136136
this.loadData(this.props.params.name);
137137
}
138138
});
@@ -141,7 +141,7 @@ class Views extends TableView {
141141
// Fallback to local storage
142142
const views = ViewPreferences.getViews(app.applicationId);
143143
this.setState({ views, counts: {} }, () => {
144-
if (this._isMounted) {
144+
if (this._isMounted && !skipDataReload) {
145145
this.loadData(this.props.params.name);
146146
}
147147
});
@@ -757,6 +757,9 @@ class Views extends TableView {
757757
view={this.state.editView}
758758
onCancel={() => this.setState({ editView: null, editIndex: null })}
759759
onConfirm={view => {
760+
// Use the original view name (before editing) to check if it's the currently displayed view
761+
const originalViewName = this.state.editView?.name;
762+
const isEditingCurrentView = originalViewName === this.props.params.name;
760763
this.setState(
761764
state => {
762765
const newViews = [...state.views];
@@ -772,7 +775,10 @@ class Views extends TableView {
772775
this.showNote('Failed to save view changes', true);
773776
}
774777
}
775-
this.loadViews(this.context);
778+
// Only reload data if we're editing the currently displayed view
779+
// Otherwise just reload the view list without reloading data
780+
const skipDataReload = !isEditingCurrentView;
781+
this.loadViews(this.context, skipDataReload);
776782
}
777783
);
778784
}}

0 commit comments

Comments
 (0)