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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(staff): Convert sudo modal to functional #71100

Merged
merged 4 commits into from
May 21, 2024

Conversation

schew2381
Copy link
Member

@schew2381 schew2381 commented May 17, 2024

Change this component to functional in order to try using useContext in a future PR.

I removed busy because it wasn't used anywhere 馃

Props to @michellewzhang for carrying most of the work on this 馃槑

@schew2381 schew2381 self-assigned this May 17, 2024
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 17, 2024
@michellewzhang michellewzhang force-pushed the seiji/chore/convert-sudo-modal-to-functional branch from 5bb1a57 to 9bbc583 Compare May 17, 2024 13:02
@schew2381 schew2381 force-pushed the seiji/chore/convert-sudo-modal-to-functional branch from 9bbc583 to ee1d485 Compare May 17, 2024 13:05
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label May 17, 2024
@michellewzhang michellewzhang force-pushed the seiji/chore/convert-sudo-modal-to-functional branch from ee1d485 to 9bbc583 Compare May 17, 2024 13:09
@schew2381 schew2381 removed the Scope: Backend Automatically applied to PRs that change backend components label May 17, 2024
@getsentry getsentry deleted a comment from github-actions bot May 17, 2024
@schew2381 schew2381 requested review from a team and saponifi3d May 17, 2024 13:11
@schew2381 schew2381 marked this pull request as ready for review May 17, 2024 13:12
Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks generally good to me, feel free to treat comments as nits.

Comment on lines 57 to 65
closeModal,
isSuperuser,
location,
needsReload,
router,
retryRequest,
api,
Header,
Body,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all of these to be props? For example, we could change router to:

const router = useRouter();

By importing components and/or using hooks for these props, it helps keep the components signature cleaner and makes the component a little easier to use.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useRouter is deprecated, what should be used instead? we can replace router, api, and location with hooks

try {
await logout(api);
} catch {
// ignore errors
}
window.location.assign(this.getAuthLoginPath());
window.location.assign(getAuthLoginPath());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than using window.location can we use router to change the history? The difference for the user would be a full page load vs a react page transition. (feel free to ignore this if we need to do a full page load to validate cookies / auth)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need one more request to validate 鉀筹笍

@cathteng cathteng merged commit d2ea815 into master May 21, 2024
41 of 42 checks passed
@cathteng cathteng deleted the seiji/chore/convert-sudo-modal-to-functional branch May 21, 2024 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants