diff --git a/packages/oruga/src/composables/defineClasses.ts b/packages/oruga/src/composables/defineClasses.ts index 1743c523d..9dc49ee10 100644 --- a/packages/oruga/src/composables/defineClasses.ts +++ b/packages/oruga/src/composables/defineClasses.ts @@ -84,7 +84,9 @@ export function defineClasses( scope.run(() => { watch( () => toValue(suffix), - () => { + (value, oldValue) => { + // only recompute when value has really changed + if (value === oldValue) return; // recompute the class bind property const classBind = getClassBind(); // update class binding property by class index @@ -99,7 +101,10 @@ export function defineClasses( scope.run(() => { watch( () => toValue(apply), - (applied) => { + (applied, oldValue) => { + // only change apply when value has really changed + if (applied === oldValue) return; + // get class binding property by class index const classBind = classes.value[index]; diff --git a/packages/oruga/src/utils/helpers.ts b/packages/oruga/src/utils/helpers.ts index 17ba6cf70..53812d43a 100644 --- a/packages/oruga/src/utils/helpers.ts +++ b/packages/oruga/src/utils/helpers.ts @@ -1,5 +1,3 @@ -import { unref } from "vue"; - /** * Generates a random string */ @@ -106,8 +104,7 @@ export function indexOf( export const isObject = (obj: T): boolean => obj && typeof obj === "object" && !Array.isArray(obj); -export const isDefined = (d: T): boolean => - unref(d) !== null && unref(d) !== undefined; +export const isDefined = (d: T): boolean => d !== null && d !== undefined; export function blankIfUndefined(value: string): string { return typeof value !== "undefined" && value !== null ? value : "";