Skip to content

Commit

Permalink
fix(core): free trial shows twice (#5837)
Browse files Browse the repository at this point in the history
* fix(core): free trial shows twice

* fix: new commit to re-run rules
  • Loading branch information
pedrobonamin authored Feb 27, 2024
1 parent 47fed89 commit e774ce1
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ export const FreeTrialProvider = ({children}: FreeTrialProviderProps) => {
}
}, [showDialog, data, showOnLoad, telemetry])

// This is casted to a string to make it stable across renders so it doesn't trigger multiple times the effect.
const searchParamsAsString = new URLSearchParams(router.state._searchParams).toString()

useEffect(() => {
// See if we have any parameters from the current route
// to pass onto our query
const searchParams = new URLSearchParams(router.state._searchParams)
const searchParams = new URLSearchParams(searchParamsAsString)

const queryParams = new URLSearchParams()
queryParams.append('studioVersion', SANITY_VERSION)
Expand Down Expand Up @@ -81,7 +84,7 @@ export const FreeTrialProvider = ({children}: FreeTrialProviderProps) => {
return () => {
request.unsubscribe()
}
}, [client, router])
}, [client, searchParamsAsString])

const toggleShowContent = useCallback(
(closeAndReOpen = false) => {
Expand Down

0 comments on commit e774ce1

Please sign in to comment.