filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.69k stars 2.91k forks source link

Column Tooltip will not correctly disappear if content is evaluated by Closure #11599

Closed thettler closed 1 month ago

thettler commented 8 months ago

Package

filament/filament

Package Version

3.2.34

Laravel Version

v10.45.1

Livewire Version

v3.4.6

PHP Version

8.3.2

Problem description

If you have dynamic Tooltips like this:

<?php
TextColumn::make('text')                
    ->tooltip(fn(TextColumn $column, ?string $state): ?string =>
         strlen($state) <= $column->getCharacterLimit() 
            ? null 
            : $state)

And the state changes so that null would be returned the tooltip will not be disappear but still show the old value. This can happen if you use, for example, the filament/spatie-laravel-translatable-plugin package and switch languages.

Expected behavior

The Tooltip should not appear with the old value again if a falsify value is returned from the evaluation function.

Steps to reproduce

First have a evaluation function that returns a string for the tooltip, than dynamically change something to not full fill the condition and return false, null or ''.

In the Repo:

  1. Install Dependencies
  2. run php artisan migrate --seed
  3. Go to Posts
  4. Check the Tooltip on title column
  5. switch Language to Spanish
  6. Old Tooltip with english text should still be there

ResourcePath: app/Filament/Resources/Blog/PostResource.php:43

Reproduction repository

https://github.com/thettler/demo/tree/tooltip-not-disappear

Relevant log output

No response

Donate 💰 to fund this issue

Fund with Polar

StyxUA commented 6 months ago

@danharrin Seems like owner of alpine-tooltip is unresponsive :(

zepfietje commented 1 month ago

@ryangjchandler @danharrin, could you guys find the time to merge https://github.com/ryangjchandler/alpine-tooltip/pull/43 and tag a new release of the alpine-tooltip package? There's been multiple Filament bug reports that should be solved by that PR.

ryangjchandler commented 1 month ago

@zepfietje Bump dependency to v2.0.1 and should be good to go.

zepfietje commented 1 month ago

That's quick, thanks Ryan! This issue should be fixed after https://github.com/filamentphp/filament/commit/fe50f8e6c9f2f7ac9a5dd76797cd3165733934c9.