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

track js active symbol #196

Conversation

mayuran-deriv
Copy link
Contributor

No description provided.

@mayuran-deriv mayuran-deriv changed the title fix: active symbol track js active symbol Dec 12, 2024
Copy link

Preview Link: https://mayuran-destricture1.bot-65f.pages.dev

Name Result
Build status Completed ✅
Preview URL Visit Preview
Action URL Visit Action

@shafin-deriv
Copy link
Contributor

@mayuran-deriv Making everything default would silence the error in trackjs, but since the bot is fully dependent upon active symbols, the Blockly would be completely broken. I would suggest to spend some time on it understand the flow and if for some reason we are not getting proper response from API then we should request again to get the data.

@mayuran-deriv
Copy link
Contributor Author

mayuran-deriv commented Dec 15, 2024


Hey @shafin-deriv,

I couldn't reproduce the issue, but I found this:

if (!this.api || this.api?.connection.readyState !== 1 || force_create_connection) {
    if (this.api?.connection) {
        **ApiHelpers.disposeInstance();**
        setConnectionStatus(CONNECTION_STATUS.CLOSED);
        this.api.disconnect();
        this.api.connection.removeEventListener('open', this.onsocketopen.bind(this));
        this.api.connection.removeEventListener('close', this.onsocketclose.bind(this));
    }
    this.api = generateDerivApiInstance();
    this.api?.connection.addEventListener('open', this.onsocketopen.bind(this));
    this.api?.connection.addEventListener('close', this.onsocketclose.bind(this));
}

We are calling the disposeInstance function in api-base under these conditions. So, I think it’s probably during this time that ApiHelpers.instance becomes null, and that’s why we are getting this error:

const { active_symbols  } = ApiHelpers.instance 

Since instance is null, the destructuring fails.

In the Deriv app, we are not doing this, so it looks like this could be a temporary error. Once the API is called again, the user should be able to see the data. so can we go ahead with my solution ? or else do we need to set initialize again after if (setInstance) ?

related to this commit e7fa511#diff-3b0931891357dd6358fa53dcd1ab528d4de6ec5e344c41956adbe694df9e4c89

@mayuran-deriv Making everything default would silence the error in trackjs, but since the bot is fully dependent upon active symbols, the Blockly would be completely broken. I would suggest to spend some time on it understand the flow and if for some reason we are not getting proper response from API then we should request again to get the data.

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

Successfully merging this pull request may close these issues.

2 participants