cube icon indicating copy to clipboard operation
cube copied to clipboard

useCubeQuery's number of re-renders

Open bowie-sine opened this issue 1 month ago • 1 comments

Hi Cube Team,

I have a performance question regarding useCubeQuery.

I'm observing that adding useCubeQuery to a component increases its re-render count from ~3 to ~9.

My dashboard has 15 components, each with two useCubeQuery hooks (totaling ~30 queries). My main concern is: Do these extra re-renders cause useCubeQuery to send new API requests to Cube Cloud every time?

We are running into rate-limit issues, and I'm trying to confirm if this high re-render count is the cause, or if the hook's internal caching should be preventing repeated fetches even if the component re-renders.

Any insight on this behavior would be very helpful.

bowie-sine avatar Nov 13 '25 11:11 bowie-sine

I believe it will only trigger an api request on a change to the query argument to useCubeQuery. Looks like it compares the object rather than just the reference so you should not get multiple api calls unless you remount your component.

johnhunter avatar Nov 21 '25 12:11 johnhunter