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

getSSRProps is not defined in the directive #8

Open
Evertvdw opened this issue Oct 27, 2023 · 1 comment
Open

getSSRProps is not defined in the directive #8

Evertvdw opened this issue Oct 27, 2023 · 1 comment

Comments

@Evertvdw
Copy link

Hello! Thanks for making this library! I am going to use it in my project :)

I am using SSR though and that will throw an error when you include the v-tippy directive in any template that gets rendered during SSR.

The directive needs a getSSRProps function, as explained here: https://vuejs.org/guide/scaling-up/ssr.html#custom-directives. I don't think this directive has to do anything on SSR as tooltips are not really something that is relevant for the initial HTML rendered

As a current workaround you can do something like this:

import { TippyDirective } from "tippy.vue";

const _directive = TippyDirective as ObjectDirective;
_directive.getSSRProps = () => {
return {};
};
app.directive("tippy", _directive);

But it would be nice to include the getSSRProps in the actual source.

@thecodewarrior
Copy link
Owner

Thanks for the report! I'll definitely take a look. The v-tippy directive does add prop/attributes, but they aren't used until after everything is mounted, which is probably why the empty implementation still works. I've had my fair share of frustration with libraries that don't work in SSR, so I'm glad the workaround is so simple :)

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