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

Charts disappear when changing tabs in Arc browser #1598

Closed
Thimows opened this issue May 18, 2024 · 3 comments
Closed

Charts disappear when changing tabs in Arc browser #1598

Thimows opened this issue May 18, 2024 · 3 comments

Comments

@Thimows
Copy link

Thimows commented May 18, 2024

It seems to be happening when opening a chart on Arc and switching tabs. This is also happening on the official demo page (see attached video)

Screenshots:

Video.Compressor.May.18.mp4
@x1i4b1x2
Copy link

It happens in Chrome, though less frequently, the issue is in 4.1.4. The version 4.1.3 is fine.

@SlicedSilver
Copy link
Contributor

This appears to be a chrome bug (see https://issues.chromium.org/issues/328755781).

As a temporary workaround, you could use the following:

document.addEventListener('visibilitychange', () => {
    const canvasElements = document.querySelectorAll('.tv-lightweight-charts canvas');
    Array.from(canvasElements).forEach((el) => {
        const ctx = el.getContext('2d');
        ctx.save();
        ctx.fillStyle = "rgba(0, 0, 0, 0)";
        ctx.fillRect(0, 0, 1, 1);
        ctx.restore();
    });
});

or just call applyOptions({}) on the charts when the tab is restored:

const chart = createChart('container');
// ...
document.addEventListener('visibilitychange', () => chart.applyOptions({}));

I'll look into a patch release for the library which will include a workaround for this issue.

@SlicedSilver
Copy link
Contributor

https://issues.chromium.org/issues/328755781#comment95

The fix is currently rolling out via a server-side config. Once the gradual rollout is complete (it takes a few hours), impacted users can restart their browser and get the fix. Separately, the fix is getting backported to Chrome 125 and 126. The next minor update of Chrome Stable 125 will thus get the fix, independently of the server-side rollout (which will be quicker).

Seems like this fix won't be required since Chrome is going to push a server-side fix.

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 a pull request may close this issue.

3 participants