Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating tp content from empty to value doesn't create the tp instance #138

Open
MichalK6677 opened this issue Jun 8, 2023 · 6 comments · May be fixed by #139
Open

Updating tp content from empty to value doesn't create the tp instance #138

MichalK6677 opened this issue Jun 8, 2023 · 6 comments · May be fixed by #139

Comments

@MichalK6677
Copy link

When tooltip is initialized as empty string, null or undefined and value of the tooltip is loaded later then instance of tippy is not created.

Try stackblitz:
https://stackblitz.com/edit/kulxrc

The problem seems to be in createInstance function (image below). Instance is not created when content is empty and it's not created later when content is set to value.
image

@stackblitz
Copy link

stackblitz bot commented Jun 8, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@shaharkazaz shaharkazaz changed the title Lazy loaded tooltip not working Updating tp content from empty to value doesn't create the tp instance Jun 8, 2023
@shaharkazaz
Copy link
Contributor

You are welcome to open a PR for it 👍

@MichalK6677
Copy link
Author

MichalK6677 commented Jun 8, 2023

I just need to remove the if condition completely.It's seems enough to make it working but I see many comits related to the IF condition in the past so I guess it's an intention to have it there, isn't it?
It has been reworked many times but my use case is to rollback it before the first change and just allow null, undefined or empty string. It does not cause any issues at the first glance in my test code.

What's the purpose of that IF condition?

@shaharkazaz
Copy link
Contributor

Obviously removing the condition isn't the solution 🙂
If you have a nullish value, why do we need to create the tippy instance? we have nothing to show. we only need to create it in case we have a value to show in the tooltip.
The solution here is to create/destroy the instance depending on the content changes as well and not just on initialization.

MichalK6677 pushed a commit to MichalK6677/helipopper that referenced this issue Jun 9, 2023
@KShewengger
Copy link

KShewengger commented Nov 7, 2023

I've come across this problem too.

It happens when the initial value is null or undefined, and it only gets provided after some time — a scenario that's quite common when working with ngrx, given that state can evolve from being nullish to having a concrete value. In these cases, the tooltip doesn't appear unless the [tp]="variable$ | push" or [tp]="variable()" is already set with a value that's not null or undefined initially.

@benbrowning
Copy link

I'm also seeing this problem when using pipe async.
For example:
[tp]="getMyTooltiptext() | async"
does not render a tooltip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants