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

Window is not defined error #873

Open
rycustodio opened this issue Feb 23, 2023 · 2 comments
Open

Window is not defined error #873

rycustodio opened this issue Feb 23, 2023 · 2 comments

Comments

@rycustodio
Copy link

Describe the bug

I've added a listener and this error is showing.

Steps to reproduce

This is my code:

const [branchBanner, setBannerIsShowing] = useState(false);

  useEffect(() => {
    const initAndFetch = async () => {
      const branch = (await import('branch-sdk')).default;
      branch.closeJourney();
      branch.init(key);
      branch.track('pageview', { experiment: 'gen-banner' });

      branch.setBranchViewData({
        data: {
          x: 'open',
          y: id,
        },
      });

      branch.addListener(JourneyEvent.didShowJourney, () => {
        setBannerIsShowing(true);
      });

    };

    if (isMobile) {
      void initAndFetch();
    }
  }, [isMobile, id]);

Expected Behavior

There should be no error

Additional Information/Context

No response

SDK version used (window.branch.sdk)

2.58.2

Environment

chrome Version 110.0.5481.100

@Mihai-github
Copy link

+1

@bogoroh
Copy link

bogoroh commented Dec 14, 2023

Also experience this. Any idea ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants