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

Allow handlerInstallPath to work without stateStore #1507

Merged
merged 1 commit into from
Jul 7, 2022

Conversation

rockingskier
Copy link
Contributor

@rockingskier rockingskier commented Jul 3, 2022

Summary

#1506

This is a bit of a guess. It worked when I edited the compiled code in my node_modules 🤮 but I wouldn't be surprised if there was a better way :)

I can't run the tests locally so I'm fully expecting them to fail. This is more of a "here's what I found" PR.

Requirements (place an x in each [ ])

@rockingskier rockingskier force-pushed the install-path-handler branch from a06a2bf to bcb3086 Compare July 3, 2022 19:36
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

Could you check my comments?

} else if (typeof existingCookies === 'string') {
allCookies.push(existingCookies);
let state;
if (this.stateStore) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you use this.stateVerification flag instead and place L340 - L342 that you've deleted inside the if statement?

Suggested change
if (this.stateStore) {
if (this.stateVerification) {

Copy link
Contributor Author

@rockingskier rockingskier Jul 4, 2022

Choose a reason for hiding this comment

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

I did that initially but it makes TS sad due to this.stateStore being optional.

Screenshot 2022-07-04 at 07 30 31

I can do:

  • if (this.stateStore)
  • `if(this.stateVerification && this.stateStore)
  • await this.stateStore?.generateStateParam but this gets complicated as state then becomes optional

Copy link
Member

Choose a reason for hiding this comment

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

How about doing like this? I would like the logic to check if this.stateVerification is true first.

if (this.stateVerification) {
  if (this.stateStore) {
    // the normal pattern
  } else {
    // have the codes L340 - L342
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good 👍 Done.

packages/oauth/src/install-provider.ts Outdated Show resolved Hide resolved
@seratch seratch self-assigned this Jul 3, 2022
@seratch seratch added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:oauth applies to `@slack/oauth-helper` labels Jul 3, 2022
@seratch seratch added this to the [email protected] milestone Jul 3, 2022
@rockingskier rockingskier force-pushed the install-path-handler branch from bcb3086 to 905f3e2 Compare July 4, 2022 09:03
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

Can you resolve the TS compilation error?

@rockingskier rockingskier force-pushed the install-path-handler branch from 905f3e2 to 72b3213 Compare July 7, 2022 06:29
@rockingskier
Copy link
Contributor Author

Sorted my local env and now I'm not coding blind :)

Fixed, tests passing locally. Hopefully all good to go.

Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

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

Looks great to me! Thanks for contributing to this SDK!

@seratch seratch merged commit aba19a4 into slackapi:main Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:oauth applies to `@slack/oauth-helper`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants