Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Add withSession utility method #83

Merged
merged 1 commit into from
Jan 25, 2021
Merged

Add withSession utility method #83

merged 1 commit into from
Jan 25, 2021

Conversation

thecodepixi
Copy link
Contributor

@thecodepixi thecodepixi commented Jan 20, 2021

WHAT is this pull request doing?

Adds withSession util/helper. This allows the user to pass in a set of parameters and receive back a client that is already hooked into the current active session (or the requested offline session), as well as the session itself.

For review, I would love extra eyes on my testing setup (all lines are covered but is there anything I should change or improve?).

Additionally, wondering if we should move this into the clients directory, as I think it would make sense to be able to call ShopifyAPI.Clients.withSession(<params>) from an end-user experience perspective.

@thecodepixi thecodepixi force-pushed the with-session branch 2 times, most recently from 4ddf98d to eeb940e Compare January 22, 2021 14:58
@thecodepixi thecodepixi marked this pull request as ready for review January 22, 2021 15:00
@thecodepixi thecodepixi requested a review from a team as a code owner January 22, 2021 15:00
@thecodepixi thecodepixi changed the title [WIP] Add withSession utility method Add withSession utility method Jan 22, 2021
Copy link
Contributor

@paulomarg paulomarg left a comment

Choose a reason for hiding this comment

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

Looks really good overall! Had a couple of minor comments but the logic looks solid to me.

src/utils/test/with-session.test.ts Outdated Show resolved Hide resolved
src/utils/test/with-session.test.ts Outdated Show resolved Hide resolved
src/utils/types.ts Outdated Show resolved Hide resolved
src/utils/with-session.ts Outdated Show resolved Hide resolved
@thecodepixi
Copy link
Contributor Author

@paulomarg Any thoughts on the location of this code within the project? I think it would make a lot of sense to be able to call this off of Clients (example mentioned in my main PR comment), but I'm curious if you have any thoughts on that?

@paulomarg
Copy link
Contributor

@paulomarg Any thoughts on the location of this code within the project? I think it would make a lot of sense to be able to call this off of Clients (example mentioned in my main PR comment), but I'm curious if you have any thoughts on that?

Hm, that's an interesting question - right now I see a bit of tension between Context and Utils, where each contains a bit of the public session interface, and we also have Shopify.Session. For now I say we keep this under Utils, but we take a closer look at what the public interface looks like now in a separate PR.

Copy link
Contributor

@paulomarg paulomarg 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. Looking for the specific errors in the test makes it much easier to see what they are actually testing too, which is a nice bonus.

@thecodepixi thecodepixi merged commit 64b085e into main Jan 25, 2021
@thecodepixi thecodepixi deleted the with-session branch January 25, 2021 22:27
@paulomarg paulomarg temporarily deployed to production January 27, 2021 19:19 Inactive
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants