Survey-library: Double firing event onCurrentPageChanged

Created on 5 Mar 2018  路  3Comments  路  Source: surveyjs/survey-library

Are you requesting a feature, reporting a bug or ask a question?

bug

What is the current behavior?

The event gets called twice.

What is the expected behavior?

It should get called once. This has completely messed up our tracking analytics.

How would you reproduce the current behavior (if this is a bug)?

import React, { Component } from 'react';
import * as SurveyJs from 'survey-react';

const model = new SurveyJs.Model({ surveyId: "cc151__SECRET__9515805" });

class Discovery extends Component {
  render () {
    console.log('rendering, this gets called once');

    return (
      <SurveyJs.Survey
        model={ model }
        onCurrentPageChanged={ this.sendTrackingEvents }
        />
    )
  }

  sendTrackingEvents = model => {
    // this gets called twice for every page, even the initial page
    console.log('onCurrentPageChanged', model);
  }
}

export default Discovery;

This used to happen before when I was using React Router, but I am not using any router and it still happens. Here is the initial setup javascript.

import React from 'react';
import ReactDOM from 'react-dom';

import Discovery from '@/containers/Discovery';

const domNode = document.getElementById('root');

ReactDOM.render(<Discovery />, domNode);

  • browser: Chrome
  • browser version: all
  • surveyjs platform (react):
  • surveyjs version: 0.11
bug fixed

All 3 comments

@enricribas Indeed, I was able to reproduce the issue. We will on the fix.

Thank you,
Andrew

@enricribas It has been fixed. The fix will be available in the next minor update, in couple days.

Thank you,
Andrew

Thank you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dmitrykurmanov picture dmitrykurmanov  路  3Comments

aslanbeily picture aslanbeily  路  4Comments

faso picture faso  路  4Comments

Zucka picture Zucka  路  4Comments

misamura picture misamura  路  4Comments