Skip to content

fix(core): pass meta to useCan params #6826

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

devarsh-mavani-19
Copy link

@devarsh-mavani-19 devarsh-mavani-19 commented Jun 2, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

Currently it does not pass meta params to access control provider. Which limits the data that we may want to pass through useCan hook.

What is the new behavior?

Now it passes meta params through useCan hook

fixes (issue)
#6802

Notes for reviewers

@devarsh-mavani-19 devarsh-mavani-19 requested a review from a team as a code owner June 2, 2025 19:10
Copy link

changeset-bot bot commented Jun 2, 2025

🦋 Changeset detected

Latest commit: bf1be72

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@refinedev/core Major
@refinedev/ably Major
@refinedev/airtable Major
@refinedev/antd Major
@refinedev/appwrite Major
@refinedev/chakra-ui Major
@refinedev/devtools Major
@refinedev/graphql Major
@refinedev/hasura Major
@refinedev/inferencer Major
@refinedev/kbar Major
@refinedev/live-previews Patch
@refinedev/mantine Major
@refinedev/medusa Major
@refinedev/mui Major
@refinedev/nestjs-query Major
@refinedev/nestjsx-crud Major
@refinedev/nextjs-router Major
@refinedev/react-hook-form Major
@refinedev/react-router-v6 Major
@refinedev/react-router Major
@refinedev/react-table Major
@refinedev/remix-router Major
@refinedev/simple-rest Major
@refinedev/strapi-v4 Major
@refinedev/strapi Major
@refinedev/supabase Major
@refinedev/ui-tests Major
@refinedev/ui-types Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

netlify bot commented Jun 2, 2025

Deploy Preview for refine-doc-live-previews ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit bf1be72
🔍 Latest deploy log https://app.netlify.com/projects/refine-doc-live-previews/deploys/683dfb82b45b87000967c48e
😎 Deploy Preview https://deploy-preview-6826--refine-doc-live-previews.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@alicanerdurmaz alicanerdurmaz changed the base branch from main to next June 2, 2025 19:30
@alicanerdurmaz alicanerdurmaz changed the base branch from next to main June 2, 2025 19:31
@alicanerdurmaz
Copy link
Member

Hi @devarsh-mavani-19, thanks for the PR!

Do you have time to add some tests?

You can see the button tests here.
We can pass meta to the buttons and check if params are passed or not.

@alicanerdurmaz alicanerdurmaz added this to the May 2025 Release milestone Jun 4, 2025
@@ -43,7 +44,7 @@ export const useButtonCanAccess = (
const { data: canAccess } = useCan({
resource: props.resource?.name,
action: props.action === "clone" ? "create" : props.action,
params: { id: props.id, resource: props.resource },
params: { ...props.meta, id: props.id, resource: props.resource },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we pass this like this:

Suggested change
params: { ...props.meta, id: props.id, resource: props.resource },
params: { meta: { ...props.meta }, id: props.id, resource: props.resource },

I believe we can manage better with this way

@@ -0,0 +1,7 @@
---
"@refinedev/core": major
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"@refinedev/core": major
"@refinedev/core": patch

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

Successfully merging this pull request may close these issues.

3 participants