Skip to content

Improve memory footprint of useCanAccess when it targets a record #10828

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

Merged
merged 2 commits into from
Jul 10, 2025

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Jul 4, 2025

Problem

When wrapping many different records in <CanAccess>, its memory footpring is huge.

Solution

This is because we pass the whole record in the useQuery parameters. We can only pass the record identifier.

How It Was Tested

Before the fix:
image

After the fix:
image

Even with this small use case (records are quite simple), that's 10MB saved.

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature

@djhi djhi added the RFR Ready For Review label Jul 4, 2025
@Madeorsk Madeorsk self-requested a review July 7, 2025 15:47
Copy link
Contributor

@Madeorsk Madeorsk left a comment

Choose a reason for hiding this comment

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

Great! Can you just add the React Query Debugger as @fzaninotto suggested?

@Madeorsk Madeorsk merged commit e883d2c into master Jul 10, 2025
15 checks passed
@Madeorsk Madeorsk deleted the use-can-access-record-key branch July 10, 2025 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Development

Successfully merging this pull request may close these issues.

3 participants