chabokpush / chabok-panel

Chabok Web Dashboard
4 stars 0 forks source link

RangeError: Maximum call stack size exceeded #21

Closed mehdibb closed 5 years ago

mehdibb commented 5 years ago

This is my code:

componentWillUnmount() {
    console.log("willUnmount");
    const { typememberid } = this.state;
    this.chabok = new chabokpush(authConfig, options);
    console.log(typememberid, authConfig.username, options.realtime);
    console.log(Base64.decode(this.props.user.phone));
    this.chabok
      .getUserId()
      .then(userId => {
        if (userId) {
          this.chabok.register(userId);
          console.log("already registered", userId);
        } else {
          console.log("name: ", name);
          this.chabok
            .register(Base64.decode(this.props.user.phone))
            .then(({ deviceId }) => {
              console.log("Registered", deviceId);
              console.log("TypememberID: ", typememberid);
            })
            .catch(error => {
              console.log("Failed to register", error);
            });
        }
      })
      .catch(error => {
        console.log("Fail to get user ID", error);
      });
    this.chabok
      .getUserId()
      .then(res => {
        console.log(res);
      })
      .catch(err => {
        console.log("failed sub: ", err);
      });
    this.chabok.subscribe(`private/${typememberid}`);  ////////////////this is where i subscribe on channel
    this.chabok.on("message", msg => {
      console.log(msg.content);
      PushNotification.localNotification({
        message: msg.content
      });
    });
  }

/////////////////////// This is the error:

RangeError: Maximum call stack size exceeded
This error is located at:
    in Register (created by Connect(Register))
    in Connect(Register) (at navigationStore.js:525)
    in Wrapped (at SceneView.js:17)
    in SceneView (at CardStack.js:455)
    in RCTView (at View.js:71)
    in View (at CardStack.js:454)
    in RCTView (at View.js:71)
    in View (at CardStack.js:453)
    in RCTView (at View.js:71)
    in View (at createAnimatedComponent.js:147)
    in AnimatedComponent (at Card.js:12)
    in Card (at PointerEventsContainer.js:39)
    in Container (at CardStack.js:498)
    in RCTView (at View.js:71)
    in View (at CardStack.js:414)
    in RCTView (at View.js:71)
    in View (at CardStack.js:413)
    in CardStack (at CardStackTransitioner.js:67)
    in RCTView (at View.js:71)
    in View (at Transitioner.js:142)
    in Transitioner (at CardStackTransitioner.js:19)
    in CardStackTransitioner (at StackNavigator.js:41)
    in Unknown (at createNavigator.js:13)
    in Navigator (at createNavigationContainer.js:226)
    in NavigationContainer (at LightboxNavigator.js:35)
    in RCTView (at View.js:71)
    in View (at LightboxNavigator.js:34)
    in Unknown (at createNavigator.js:13)
    in Navigator (at createNavigationContainer.js:226)
    in NavigationContainer (at SceneView.js:17)
    in SceneView (at CardStack.js:455)
    in RCTView (at View.js:71)
    in View (at CardStack.js:454)
    in RCTView (at View.js:71)
    in View (at CardStack.js:453)
    in RCTView (at View.js:71)
    in View (at createAnimatedComponent.js:147)
    in AnimatedComponent (at Card.js:12)
    in Card (at PointerEventsContainer.js:39)
    in Container (at CardStack.js:498)
    in RCTView (at View.js:71)
    in View (at CardStack.js:414)
    in RCTView (at View.js:71)
    in View (at CardStack.js:413)
    in CardStack (at CardStackTransitioner.js:67)
    in RCTView (at View.js:71)
    in View (at Transitioner.js:142)
    in Transitioner (at CardStackTransitioner.js:19)
    in CardStackTransitioner (at StackNavigator.js:41)
    in Unknown (at createNavigator.js:13)
    in Navigator (at createNavigationContainer.js:226)
    in NavigationContainer (at Router.js:72)
    in App (at Router.js:93)
    in Router (created by Connect(Router))
    in Connect(Router) (at App.js:115)
    in PersistGate (at App.js:111)
    in Provider (at App.js:110)
    in RCTView (at View.js:71)
    in View (at Root.js:13)
    in Root (at connectStyle.js:384)
    in Styled(Root) (at App.js:109)
    in App (at AppRegistryInjection.js:68)
    in _class (at AppRegistryInjection.js:67)
    in RCTView (at View.js:71)
    in View (at AppRegistryInjection.js:66)
    in Root(Selfit) (at renderApplication.js:35)
    in RCTView (at View.js:71)
    in View (at AppContainer.js:102)
    in RCTView (at View.js:71)
    in View (at AppContainer.js:122)
    in AppContainer (at renderApplication.js:34)
Husseinhj commented 5 years ago

این موضوع در نسخه جدید کتابخونه pure js حل خواهد شد. می‌تونین موقتا به این شکل که در issue #5 گفته شده این موضوع رو حل کنین.