Skip to content

Commit

Permalink
Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
timowestnosto committed Jul 22, 2024
1 parent 3824b6d commit 72028c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/NostoProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, isValidElement } from "react"
import { NostoContext, RecommendationComponent } from "../context"
import { NostoClient } from "../types"
import { isNostoLoaded } from "./helpers"

/**
* @group Components
Expand Down Expand Up @@ -86,7 +87,7 @@ export default function NostoProvider(props: NostoProviderProps) {
window.nostojs(api => api.setAutoLoad(false))
}

if (!window.nosto && !shopifyMarkets) {
if (!isNostoLoaded() && !shopifyMarkets) {
const script = document.createElement("script")
script.type = "text/javascript"
script.src = "//" + (host || "connect.nosto.com") + "/include/" + account
Expand Down
3 changes: 3 additions & 0 deletions src/components/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isNostoLoaded() {
return typeof window.nosto !== "undefined"
}

0 comments on commit 72028c7

Please sign in to comment.