Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove authState.isPending#215

Open
mraible wants to merge 1 commit intookta:master from
mraible:patch-1
Open

Remove authState.isPending #215
mraible wants to merge 1 commit intookta:master from
mraible:patch-1

Conversation

@mraible
Copy link
Contributor

@mraible mraible commented Jun 28, 2021

Question: is it possible to do !authState?.isAuthenticated instead of !authState && !authState.isAuthenticated?

Question: is it possible to do `!authState?.isAuthenticated` instead of `!authState && !authState.isAuthenticated`?
Copy link
Contributor Author

mraible commented Jun 28, 2021

It looks like this file needs to be fixed too.

Copy link
Contributor

denysoblohin-okta commented Jun 29, 2021
edited
Loading

Thanks for submitting this PR.
Yes, isPending is obsolete and should be removed.

Code !authState.isPending && should be removed completely, no need to change it to !authState because there are lines before that make this check:

if (!authState) {
return null;
}

Same for this file

Copy link
Contributor Author

mraible commented Jun 30, 2021
edited
Loading

@denysoblohin-okta How should I change this line? If I remove the conditionals, will a login button still be rendered?

{!authState.isPending && !authState.isAuthenticated && <Menu.Item onClick={login}>Login</Menu.Item>}

Copy link
Contributor

shuowu commented Jul 14, 2021

@mraible where did you see the issues with the code snippet above? this sample repo or other apps?
As optional chaining is a part of ES2020, you may need to config the transpiler to make it work.

Copy link
Contributor Author

mraible commented Aug 3, 2021

@shuowu It worked for OktaDev Schematics, which generates an app with the latest version of Create React App. oktadev/schematics@2c90198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /