Skip to content

Commit

Permalink
fix: warn on unavailable lazy load not throw (#1400)
Browse files Browse the repository at this point in the history
* fix: warn on unavailable lazy load not throw

* and a default
  • Loading branch information
pauldambra authored Sep 9, 2024
1 parent 25cffae commit c76ea97
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/posthog-surveys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,9 @@ export class PostHogSurveys {

// this method is lazily loaded onto the window to avoid loading preact and other dependencies if surveys is not enabled
private _canActivateRepeatedly(survey: Survey) {
if (isNullish(assignableWindow.__PosthogExtensions__.canActivateRepeatedly)) {
if (isNullish(assignableWindow.__PosthogExtensions__?.canActivateRepeatedly)) {
logger.warn(LOGGER_PREFIX, 'canActivateRepeatedly is not defined, must init before calling')
return false // TODO does it make sense to have a default here?
}
return assignableWindow.__PosthogExtensions__.canActivateRepeatedly(survey)
}
Expand Down

0 comments on commit c76ea97

Please sign in to comment.