meteor-roles icon indicating copy to clipboard operation
meteor-roles copied to clipboard

Handle large role collection by persisting on client when user is logged it.

Open danyhiol opened this issue 3 years ago • 3 comments

I have a very complex and large role collection. Since these permissions are needed when the user is logged in, it takes quite some time for my application to load. I have more than 300 inherited roles and this may actually grow larger. Is there a way to persist roles on the client and only read from the client as long as the user is logged in? This package actually helps in persisting the roles on the client. But how can I connect the role package to this persisted collection on the client?

danyhiol avatar Feb 27 '21 22:02 danyhiol

I don't know if I quite correctly understand the problem you're facing. Would disabling the synchronization of the roles collection fix it? You'd then be responsible yourself to see whether and when you need it and publish it (see https://github.com/Meteor-Community-Packages/meteor-roles/issues/256).

SimonSimCity avatar Feb 28 '21 22:02 SimonSimCity

The main idea is to get the subscription only once when the user is connected. And persist the data on the client and use them from there. If disabling synchronization doesn't stop the roles from working, then yes.

danyhiol avatar Mar 03 '21 14:03 danyhiol

Thanks for the response. To me, personally, this is an improvement Meteor should bring. It might also be already suficcient to transfer as little data as possible to the client - maybe you can do what you want already by omitting the roles alltogether or focus on using methods when you have to access/query a vast amount of data.

SimonSimCity avatar Mar 03 '21 16:03 SimonSimCity