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

Unable to import reactiveAbility from casl/vue #890

Open
Waqar-SE opened this issue Mar 22, 2024 · 5 comments
Open

Unable to import reactiveAbility from casl/vue #890

Waqar-SE opened this issue Mar 22, 2024 · 5 comments

Comments

@Waqar-SE
Copy link

Describe the bug
Unable to import reactiveAbility

To Reproduce
Steps to reproduce the behavior:
Try to import reactiveAbility and it will fail as index.js doesn't provide it.

Expected behavior
Successful import of reactiveAbility

CASL Version
@casl/vue - v

Environment:

Node 20, Vue 3

@Waqar-SE Waqar-SE added the bug label Mar 22, 2024
@stalniy
Copy link
Owner

stalniy commented Mar 27, 2024

I has never been a part of public interface. Could you please explain why do you need it?

@Waqar-SE
Copy link
Author

For me the usecase is providing abilities to render function when testing the components.

@stalniy
Copy link
Owner

stalniy commented Mar 30, 2024

in this case it's an improvement not a bug. Why cannot you use plugin or provide/inject in tests?

@stalniy stalniy added enhancement and removed bug labels Mar 30, 2024
@Waqar-SE
Copy link
Author

Waqar-SE commented Mar 30, 2024

To be able to provide the ability I need to build it, that's where the reactive ability is needed, to build the ability.

@stalniy
Copy link
Owner

stalniy commented Mar 30, 2024

You don’t need it because it’s hidden inside provideAbility and abilitiesPlugin

build ability in any way you like, casl/vue will make it reactive when you provide it. See the code:

https://github.com/stalniy/casl/blob/master/packages/casl-vue/src/useAbility.ts#L17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants