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

Using x-tooltip.raw with additional inline modifiers returns error "Unexpected token '}' at new AsyncFunction" #47

Open
TheInterceptorLee opened this issue Dec 4, 2024 · 1 comment

Comments

@TheInterceptorLee
Copy link

While using x-tooltip.raw independently, or by using x-tooltip accessing the x-data variables, the framework works fine. But I've encountered a problem while trying to use x-tooltip.raw together with the many different modifiers that the frameworks provides and I don't know exactly if I'm doing something wrong or if I've missed something here. But I'm pretty sure that Tippy is having some problems dealing with different modifiers to customize a specific tooltip with this framework. I'll get in details now:

I've the following snippet in my code:

<a class="btn-4 dp-flex row v-center h-left gap-10px py-6px px-15px w100" id="nomeDoId" href="#" target="_self" x-tooltip.placement.top x-tooltip.delay.1000 x-tooltip.raw="Alertas de Registros">
    // Content of my button
</a>

Important note: This is not only happening with x-tooltip.placement or x-tooltip.delay but with all modifiers that doesn't require a written "value" between quotes after the equal symbol.

This code returns the following error:

"Unexpected token '}' at new AsyncFunction"

alpinejs.js?v=22d1455f:428 Uncaught SyntaxError: Unexpected token '}'
at new AsyncFunction ()
at safeAsyncFunction (alpinejs.js?v=22d1455f:475:19)
at generateFunctionFromString (alpinejs.js?v=22d1455f:488:14)
at generateEvaluatorFromString (alpinejs.js?v=22d1455f:493:14)
at normalEvaluator (alpinejs.js?v=22d1455f:455:109)
at Function.evaluateLater (alpinejs.js?v=22d1455f:445:10)
at Function. (@ryangjchandler_alpine-tooltip.js?v=b9962913:3448:26)
at flushHandlers (alpinejs.js?v=22d1455f:585:46)
at stopDeferring (alpinejs.js?v=22d1455f:590:5)
at deferHandlingDirectives (alpinejs.js?v=22d1455f:593:3)

For some reason, if I use the x-data method, or the x-tooltip.raw alone, this doesn't happen. For further guidance, I'll also share how I've settled any permanent settings in my .js file:

Alpine.plugin(
    Tooltip.defaultProps({
        delay: 50,
        theme: 'labs',
        // ...
    }),
)

By default, every tooltip must follow these instructions, and only change if personally instructed. I don't know if this can be some kind of incompatibility with Tippy or even AlpineJS... Or if its something that I'm doing wrong.

OBS: You can see in my .js file that I've settled a custom 'theme' for my tooltip. I highly believe that this is not the problem, or even related to it, because the theme works as intended when I'm setting the tooltip using the others methods you've listed available.

Could you help me? Thank you a lot in advance!

@hugronaphor
Copy link

Same here while using default configs.

The x-tooltip.html is causing it

<button x-data x-tooltip.html x-tooltip.raw="(Total Accrued - Available funds) + Invested funds<br /><br />sdcsd">
  Info
</button>

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

No branches or pull requests

2 participants