You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I'm loading a page -- for example -- /printing-house, the can function runs every time for each resource and if the current route is wrapped with CanAccess then it waits for the execution of the can function for all resources, which makes loading of pages very slow...
I tried using cacheTime to cahce the results but does not seem to do anything. The can function still runs for each resource and the slow behavior keeps occuring.
Steps To Reproduce
Copy my setup
Wrap a route with CanAccess
Initial load
Reload page and see if can still runs again and if it's slow
Expected behavior
Resource control needs to be determined on first run and then cached for the cache time.
Packages
@refinedev/antd
@refinedev/nextjs
Additional Context
Additionally, I was wondering if there is a way to prioritize checking access for the current resource and then showing it immediately instead of having to wait for all the checks. That would solve the issue as well.
The text was updated successfully, but these errors were encountered:
Hello @omerdn1, Thanks for the detailed explanation
Actually, TanStack Query already has a very good caching mechanism. If you’re making repeated requests, it’s probably because the query key is changing. For example, you’ll be making requests again and again for different resources because the query key changes.
I don’t think this is a bug but rather an issue in your implementation. If you share a reproducible example, I can help debug it.
Describe the bug
Hi, I have the following Refine setup:
When I'm loading a page -- for example -- /printing-house, the
can
function runs every time for each resource and if the current route is wrapped withCanAccess
then it waits for the execution of thecan
function for all resources, which makes loading of pages very slow...I tried using
cacheTime
to cahce the results but does not seem to do anything. Thecan
function still runs for each resource and the slow behavior keeps occuring.Steps To Reproduce
Expected behavior
Resource control needs to be determined on first run and then cached for the cache time.
Packages
Additional Context
Additionally, I was wondering if there is a way to prioritize checking access for the current resource and then showing it immediately instead of having to wait for all the checks. That would solve the issue as well.
The text was updated successfully, but these errors were encountered: