mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix unexpected camera update and unavailable clustering option in map (#9615)
* Fix unexpected camera update and unavailable clustering option in map layout. * lint warning * Use defaultSort ref instead of value. Co-authored-by: Azri Kahar <azrikahar@outlook.com>
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
import { isFunction } from 'lodash';
|
||||
import { computed, Ref } from 'vue';
|
||||
import { computed, Ref, unref } from 'vue';
|
||||
|
||||
export function syncRefProperty<R, T extends keyof R>(ref: Ref<R>, key: T, defaultValue: R[T] | (() => R[T])) {
|
||||
export function syncRefProperty<R, T extends keyof R>(ref: Ref<R>, key: T, defaultValue: R[T] | Ref<R[T]>) {
|
||||
return computed<R[T]>({
|
||||
get: () => {
|
||||
return ref.value?.[key] ?? (isFunction(defaultValue) ? defaultValue() : defaultValue);
|
||||
get() {
|
||||
return ref.value?.[key] ?? unref(defaultValue);
|
||||
},
|
||||
set: (value: R[T]) => {
|
||||
set(value: R[T]) {
|
||||
ref.value = Object.assign({}, ref.value, { [key]: value }) as R;
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user