Skip to content

Commit

Permalink
Fixed #3163 - Tooltip: loose reactivity when the content is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
tugcekucukoglu committed Oct 28, 2022
1 parent 62fe1a7 commit 2573002
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/components/tooltip/Tooltip.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UniqueComponentId, DomHandler, ObjectUtils, ConnectedOverlayScrollHandler, ZIndexUtils } from 'primevue/utils';
import { ConnectedOverlayScrollHandler, DomHandler, ObjectUtils, UniqueComponentId, ZIndexUtils } from 'primevue/utils';

function bindEvents(el) {
const modifiers = el.$_ptooltipModifiers;
Expand Down Expand Up @@ -313,7 +313,7 @@ const Tooltip = {
target.$_ptooltipClass = null;
target.$_ptooltipFitContent = true;
} else if (typeof options.value === 'object' && options.value) {
if (ObjectUtils.isEmpty(options.value.value)) return;
if (ObjectUtils.isEmpty(options.value.value) || options.value.value.trim() === '') return;
else {
/* eslint-disable */
target.$_ptooltipValue = options.value.value;
Expand Down Expand Up @@ -343,21 +343,31 @@ const Tooltip = {
let target = getTarget(el);
target.$_ptooltipModifiers = getModifiers(options);

if (!options.value) return;
if (!options.value) {
unbindEvents(target);
return;
}

if (typeof options.value === 'string') {
target.$_ptooltipValue = options.value;
target.$_ptooltipDisabled = false;
target.$_ptooltipEscape = false;
target.$_ptooltipClass = null;

bindEvents(target);
} else if (typeof options.value === 'object' && options.value) {
if (ObjectUtils.isEmpty(options.value.value)) return;
else {
if (ObjectUtils.isEmpty(options.value.value || options.value.value.trim() === '')) {
unbindEvents(target);
return;
} else {
/* eslint-disable */
target.$_ptooltipValue = options.value.value;
target.$_ptooltipDisabled = !!options.value.disabled === options.value.disabled ? options.value.disabled : false;
target.$_ptooltipEscape = !!options.value.escape === options.value.escape ? options.value.escape : false;
target.$_ptooltipClass = options.value.class;
target.$_ptooltipFitContent = !!options.value.fitContent === options.value.fitContent ? options.value.fitContent : true;

bindEvents(target);
}
}
}
Expand Down

0 comments on commit 2573002

Please sign in to comment.