-
Notifications
You must be signed in to change notification settings - Fork 43
[BAH-4159] Loading All Privileges when assign #118
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
Conversation
collectAllPrivileges(initialPrivileges, allPrivileges) { | ||
allPrivileges.push(...initialPrivileges.results); | ||
if (initialPrivileges.links.length > 0 && initialPrivileges.links.find(link => link.rel === "next") !== undefined) { | ||
httpInterceptor.get(initialPrivileges.links[0].uri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the API has a bug? If the API incorrectly keeps returning a "next" link indefinitely, this function never stops calling itself. Could introducing a limit be a safer option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can introduce a limit but its like we are not trusting our systems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's always a good practice to introduce a limit. It's not that we are not trusting our systems but it's defensive programming to avoid rare but critical issues. Logic wise, it's all good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I'll go ahead and add a limit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arshiyaTW2021 I have added the limit.
…ted. Updating name for the limit constant
BAH-4159
This PR fixes the bug - Not all privileges are loaded when assigning to forms as the API is paginated.
Fetching all the privileges and then assigning it to the dropdown
BAH-4186
This PR also fixes the bug - Not all forms are loaded in thr form builder list page as the API is paginated