Skip to content

Commit 03a4476

Browse files
committed
fix: Rename view
1 parent e19488e commit 03a4476

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/renderer/store/preferences/slice.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,14 @@ const prefsSlice = createSlice({
148148
},
149149
renameStoredView(state: AppPreferencesData, { payload }: PayloadAction<RenameStoredViewAction>) {
150150
const oldIdx = state.storedViews.findIndex(v => v.view === payload.old);
151-
const existing = state.storedViews.findIndex(v => v.view === payload.new);
151+
const existingIdx = state.storedViews.findIndex(v => v.view === payload.new);
152152
if (!oldIdx) {
153-
throw 'Could not find old view to rename - ' + payload.old;
153+
alert('Could not find old view to rename - ' + payload.old);
154+
return;
154155
}
155-
if (existing) {
156-
throw 'Cannot override existing view during a rename - ' + payload.old + ' to ' + payload.new;
156+
if (existingIdx > -1) {
157+
alert('Cannot override existing view during a rename - ' + payload.old + ' to ' + payload.new);
158+
return;
157159
}
158160
state.storedViews[oldIdx].view = payload.new;
159161
},

0 commit comments

Comments
 (0)