mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
fix(core-view): CB-2022 wrap set in action
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { makeObservable, observable } from 'mobx';
|
||||
import { action, makeObservable, observable } from 'mobx';
|
||||
|
||||
import { MetadataMap } from '@cloudbeaver/core-utils';
|
||||
|
||||
@@ -25,6 +25,8 @@ export class DataContext implements IDataContext {
|
||||
this.fallback = fallback;
|
||||
|
||||
makeObservable<this, 'map'>(this, {
|
||||
set: action,
|
||||
delete: action,
|
||||
map: observable.shallow,
|
||||
fallback: observable.ref,
|
||||
});
|
||||
|
||||
@@ -33,8 +33,8 @@ export class DynamicDataContext implements IDataContext {
|
||||
set<T>(context: DataContextGetter<T>, value: T): DeleteVersionedContextCallback {
|
||||
const dynamicContext = this.contexts.get(context);
|
||||
|
||||
if (dynamicContext && this.get(context) === value) {
|
||||
return dynamicContext;
|
||||
if (this.tryGet(context) === value) {
|
||||
return dynamicContext ?? ( () => {});
|
||||
}
|
||||
|
||||
const deleteCallback = this.fallback.set(context, value);
|
||||
|
||||
Reference in New Issue
Block a user