sweebee / filament-char-counter

MIT License
27 stars 2 forks source link

Call to undefined function getState() in version 1.1.3 #11

Closed kokoshneta closed 1 year ago

kokoshneta commented 1 year ago

The recent fix to #9 appears to have broken this plugin completely for me, and I’m not sure if it’s a simple typo or if my environment is missing something.

The fix involved this commit for textareas; previously the view had this:

{{ mb_strlen($getState()) }}

– and now it has this:

{{ mb_strlen($getState() ? getState() : '') }}

– with getState() rather than $getState() in the true branch of the ternary.

I haven’t used the plugin with a text input field, but the same presumably holds true there, since the current commit for those now has this:

{{ mb_strlen(getState()? $getState()) : '' }}

– so still with getState(), but in a different position (condition instead of true branch).

But what exactly is getState(), as opposed to Filament’s $getState()? In my app, the function is not defined, and I don’t know if the initial $ was just left out by accident, or if there is actually supposed to be a getState() function defined somewhere.

Adding a $ back in fixes the issue, so I’m assuming it’s just a typo?

sweebee commented 1 year ago

thanks, yea a typo and I didn't test it. Could you test 1.1.4?

kokoshneta commented 1 year ago

Well, that was fast! Works perfectly now in 1.1.4!