Skip to content

Commit

Permalink
Fix bug where new views (created with Save As) were not being added t…
Browse files Browse the repository at this point in the history
…o ViewManagerModel.views until next refresh (#3887)
  • Loading branch information
ghsolomon authored Jan 6, 2025
1 parent e7a22fa commit 060356d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmp/viewmanager/ViewManagerModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {fmtDateTime} from '@xh/hoist/format';
import {action, bindable, makeObservable, observable, comparer, runInAction} from '@xh/hoist/mobx';
import {olderThan, SECONDS} from '@xh/hoist/utils/datetime';
import {executeIfFunction, pluralize, throwIf} from '@xh/hoist/utils/js';
import {find, isEqual, isNil, isNull, isUndefined, lowerCase} from 'lodash';
import {find, isEqual, isNil, isNull, isUndefined, lowerCase, uniqBy} from 'lodash';
import {ReactNode} from 'react';
import {ViewInfo} from './ViewInfo';
import {View} from './View';
Expand Down Expand Up @@ -609,7 +609,7 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
this.pendingValue = pendingValue;
// Ensure we update meta-data as well.
if (!view.isDefault) {
this.views = this.views.map(v => (v.token === view.token ? view.info : v));
this.views = uniqBy([view.info, ...this.views], 'token');
}
}

Expand Down

0 comments on commit 060356d

Please sign in to comment.