Coder Social home page Coder Social logo

Comments (10)

ryangjchandler avatar ryangjchandler commented on July 28, 2024

Hi @nijlandvpr I'll look at adding support for this. I think it should just be a case of setting the text for the tooltip when it's toggled.

from alpine-tooltip.

ryangjchandler avatar ryangjchandler commented on July 28, 2024

@nijlandvpr Can you see the x-data property changing in the inspector? Outside of a Livewire environment, changing the value of the property correctly updates the tooltip value.

I am able to reproduce the problem inside of a Livewire component. The x-data does update in the DOM, so I'm actually going to guess that this is a problem with how Livewire & Alpine are working together, i.e. Alpine isn't correctly re-initialising the component when the DOM is patched by Livewire.

Even without the tooltip library, a simple x-text="tooltip" doesn't update either.

from alpine-tooltip.

nijlandvpr avatar nijlandvpr commented on July 28, 2024

@ryangjchandler Thanks for taking the time on this. Yes, my scenario is inside a Liverwire component the x-data updates but the tooltip remains as it was when the page first loads.

from alpine-tooltip.

ryangjchandler avatar ryangjchandler commented on July 28, 2024

@nijlandvpr Yeah, I don't think this is a problem with the package. I'd recommend opening an issue / discussion on the Alpine or Livewire repo.

from alpine-tooltip.

nijlandvpr avatar nijlandvpr commented on July 28, 2024

@ryangjchandler Sure thing - I thought I'd start with the expert on the package. I'm also experiencing other issues with Livewire where some actions return a 404 to a "messages" route while others don't. Looks like it's losing how it recognizes DOM elements and substituting with a default - something like that anyway. New tech === "keep it simple stupid" is the message!

Thanks

from alpine-tooltip.

rcubitto avatar rcubitto commented on July 28, 2024

I encountered the same problem, I was able to solve it using @entangle and an extra property in the Livewire component (where you should store "Enable" or "Disable")

from alpine-tooltip.

nijlandvpr avatar nijlandvpr commented on July 28, 2024

@rcubitto Are you saying you use @entangle to change the text of the tooltip?

x-data={ tooltip: @entangle('someStringProp') }

from alpine-tooltip.

rcubitto avatar rcubitto commented on July 28, 2024

@nijlandvpr yes, if the value of someStringProp changes, the tooltip gets updated accordingly.

from alpine-tooltip.

nijlandvpr avatar nijlandvpr commented on July 28, 2024

@nijlandvpr yes, if the value of someStringProp changes, the tooltip gets updated accordingly.

The scenario I was looking at involved a backend rendered table, with rows containing a boolean is_disabled state. Even if is_disabled was text, looping through the rows as objects or array elements wouldn't entangle - I think!

x-data={ @entangle('user->is_disabled') }

from alpine-tooltip.

ryangjchandler avatar ryangjchandler commented on July 28, 2024

I'm going to close this issue for now since it's not a problem with the package, more of an Alpine/Livewire interop/compatibility thing.

If anybody comes here later looking for the same thing -- you can either use @entangle / $wire to keep the prop in sync, or use a method on the Livewire component that returns the value, then inside of x-tooltip do something like $wire.myMethod()

from alpine-tooltip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.