Skip to content

Commit

Permalink
fix(isDefined): remove unintended unref function (#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek authored Mar 4, 2024
1 parent f2fc5a6 commit ed75a71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 7 additions & 2 deletions packages/oruga/src/composables/defineClasses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];

Expand Down
5 changes: 1 addition & 4 deletions packages/oruga/src/utils/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { unref } from "vue";

/**
* Generates a random string
*/
Expand Down Expand Up @@ -106,8 +104,7 @@ export function indexOf<T>(
export const isObject = <T>(obj: T): boolean =>
obj && typeof obj === "object" && !Array.isArray(obj);

export const isDefined = <T>(d: T): boolean =>
unref(d) !== null && unref(d) !== undefined;
export const isDefined = <T>(d: T): boolean => d !== null && d !== undefined;

export function blankIfUndefined(value: string): string {
return typeof value !== "undefined" && value !== null ? value : "";
Expand Down

0 comments on commit ed75a71

Please sign in to comment.