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

flag for checking if preload is called at least once. Else do not cac… #17

Closed
wants to merge 2 commits into from

Conversation

cianbuckley
Copy link
Contributor

@cianbuckley cianbuckley commented Oct 12, 2023

…he checkout

Context

If we enable by default but never the client never calls preload, the first time checkout is loaded will be when the user clicks the checkout button. However, it will still be cached. So imagine the user goes back to add something to their cart.. Their checkout will not be refreshed. clears the cache by calling preload.

This PR attempts to mitigate that issue. Manually testing, it works. Needs to be more thoroughly tested

Before you deploy

  • I have added tests to support my implementation
  • I have read and agree with the contributing documentation readme
  • I have read and agree with the code of conduct documentation readme
  • I have updated any documentation related to these changes.
  • I have updated the README (if applicable).

@cianbuckley cianbuckley requested a review from a team as a code owner October 12, 2023 20:17
Copy link
Contributor

@markmur markmur left a comment

Choose a reason for hiding this comment

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

Needs tests. @kiftio will we add some before merge?

@markmur markmur requested a review from kiftio October 13, 2023 11:03
@@ -40,6 +40,7 @@ public func configure(_ block: (inout Configuration) -> Void) {

/// Preloads the checkout for faster presentation.
public func preload(checkout url: URL) {
ShopifyCheckout.configuration.preloading.preloadCalledAtLeastOnce = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think we need to reset this when the checkout completes or errors?

And/or clear the cache

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm it's a good question

@kiftio kiftio force-pushed the preload-cache-flag branch from ea20e16 to 93ebe3e Compare October 16, 2023 12:27
@igrigorik
Copy link
Contributor

Hmm, not convinced this is the right behavior. PTAL: #15 (comment)

@kiftio kiftio closed this Oct 17, 2023
@kiftio kiftio deleted the preload-cache-flag branch October 19, 2023 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants