Skip to content
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

Permission updates in the UI are slow #904

Open
3 tasks done
chronark opened this issue Jan 29, 2024 · 11 comments
Open
3 tasks done

Permission updates in the UI are slow #904

chronark opened this issue Jan 29, 2024 · 11 comments
Labels
Dashboard Unkey dashboard related Improvement Improve an existing feature

Comments

@chronark
Copy link
Collaborator

chronark commented Jan 29, 2024

Preliminary Checks

Reproduction / Replay Link (Optional)

No response

Issue Summary

We're looping through all required permissions and doing a network roundtrip for each.

async function upsertPermission(workspaceId: string, name: string): Promise<Permission> {

Steps to Reproduce

  1. https://unkey.dev/app/settings/root-keys/new
  2. add some permissions
  3. save

Expected behavior

It should be much faster

Other information

No response

Screenshots

No response

Version info

irrelevant
@chronark chronark added Bug Something isn't working Needs Approval Needs approval from Unkey labels Jan 29, 2024
Copy link

linear bot commented Jan 29, 2024

@chronark chronark added Dashboard Unkey dashboard related Improvement Improve an existing feature and removed Bug Something isn't working Needs Approval Needs approval from Unkey labels Jan 29, 2024
@Praashh
Copy link
Contributor

Praashh commented Jan 29, 2024

Hey, I have a doubt, created a new root key and I feel it's depend on the backend. is'nt it ?

@chronark
Copy link
Collaborator Author

can you elaborate?

@Praashh
Copy link
Contributor

Praashh commented Jan 30, 2024

I tried to create a root key for test the speed, I feel UI updation slow because of backend response. correct me if I am wrong please.

@chronark
Copy link
Collaborator Author

yes it's the backend that is slow, I linked the code above

@Praashh
Copy link
Contributor

Praashh commented Jan 30, 2024

So that means, we have to optimize the backend as well ?

@chronark
Copy link
Collaborator Author

the only bottleneck is in the backend, the ui just sends a trpc request

@Praashh
Copy link
Contributor

Praashh commented Jan 31, 2024

Thanks for clearing. It takes some time understand the problem statement. Got it now, Can I work on that or someone from unkey is already working upon that?

@chronark
Copy link
Collaborator Author

chronark commented Feb 2, 2024

sure, go ahead

@AkshayBandi027
Copy link
Contributor

hey @chronark,
As mentioned above We're looping through all required permissions and doing a network roundtrip for each., I guess your talking about

image

we can make use of Promise.all() for concurrently doing a network request

image

Is this related as mentioned above or i am going in wrong direction ?

@chronark
Copy link
Collaborator Author

chronark commented Feb 7, 2024

Yeah, I deliberately didn't do a promise.all, cause apparently that's an issue with planetscale

I haven't looked much deeper though and just accepted that it might be a bit slower for now.

I'm reworking permissions a little bit right now, and adding roles, potentially we don't even need to upsert in parallel anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Unkey dashboard related Improvement Improve an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants